Reputation: 1677
I need to show some html code in TextBox. this is my TextBox description:
<asp:TextBox ID="responseTextBox" runat="server"
Width="910px" ReadOnly="True" TextMode="MultiLine" CausesValidation="false" />
i am passing the html to it programatically, and it works, but on postback from page i'am getting the following error:
A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$responseTextBox=" ...
How can i disable input validation ?
Upvotes: 1
Views: 5241
Reputation: 15253
You can try adding the validaterequest=false attribute, but I would not recommend doing this. Encode/decode the HTML instead.
http://www.codersbarn.com/post/2008/11/01/ASPNET-Data-Input-Validation.aspx
Upvotes: 0
Reputation: 218732
asp.net imposes this checking to avoid script injections.But you can override this by changing the validateRequest property value to "false" in page directive
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="editpage.aspx.cs" validateRequest="false" Inherits="MyProject.UI.editpage" %>
Check here to know more about Script injection
Upvotes: 5