ASP.NET 4.0 potentially dangerous Request.Form value was detected

This was because .NET detected something in the entered text which looked like an HTML statement.
This is a feature put in place to protect your application cross site scripting attack and followed accordingly.

To disable request validation, I added the following to the existing “page” directive in that .aspx file.
[xml]ValidateRequest="false"[/xml]

For .NET 4, we need to add requestValidationMode=”2.0″ to the httpRuntime configuration section of the web.config file like the following:

[xml]<httpRuntime requestValidationMode="2.0"/>[/xml]

But if there is no httpRuntime section in the web.config file, then this goes inside the <system.web> section.

If anyone wants to turn off request validation for globally user, the following line in the web.config file within <system.web> section:

[xml]<pages validateRequest="false" /> [/xml]

Comments are closed.