MY Note

study it – know it – use it

Fix “A potentially dangerous Request.Form value was detected from the client (FreeTextBox1=”…”

1.
If you are on .net 4.0 make sure you add this in your web.config
<httpRuntime requestValidationMode=”2.0″ />

2.
myTextBox.Text = Server.HtmlEncode(myStringFromDatabase);

MyLabel.Text = HttpUtility.HtmlEncode(MyTextBox.Text)

3. To disable request validation on a page add the following directive to the existing “page” directive in the file (you will need to switch to the HTML view for this):
ValidateRequest=”false”

October 17, 2010 Posted by | asp.net 4.0 | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.