Sunday, February 20, 2011

How to deal with exception: "A potentially dangerous Request.Form value was detected from the client" in ASP.NET Webform

Cause: the content user posts in the textbox includes bracket: < >. "Request validation detects potentially malicious client input and throws this exception to abort processing of the request"

You can turn off this validation by:

  <location path="pagename.aspx">
    <system.web>
      <httpRuntime requestValidationMode="2.0" />
      <pages validateRequest="false" />
    </system.web>
  </location>

Reference:
http://msdn.microsoft.com/en-us/library/system.web.httprequestvalidationexception.aspx