Here we will see how to solve the error for potentially dangerous Request.Form value was detected from the client. Basic reason for the occurrence of this error is because asp.net prevents any attempt to compromise the security of application by script injection like cross site scripting etc.
This error occurs when end user enters any scripting / html tag<> in the inputbox. You can disable request validation by setting validateRequest=false in the page directive or in the configuration section but it is strongly recommended that your application explicitly check all inputs in this case.
To resolve this issue we can do following things.
1. Set validateRequest property to false in page directive.
<%@ Page validateRequest="false" %>
2. Set validateRequest property to false in the <pages /> section under <system.web>
section of web.config file if you want to turn off request validation globally(Entire Application).
<configuration> <system.web> <pages validateRequest="false" /> </system.web> </configuration>
3. For .NET 4 or higher we need to add requestValidationMode=”2.0″ to the httpRuntime configuration section of the web.config file
Asp.net validates all input controls for potentially unsafe contents that can lead to cross site scripting and Sql injections and so if you disable the request validation then you should check the input for any cross-site scripting (XSS) attacks.