A potentially dangerous Request.Form value was detected from the client

Problem

The following “yellow screen” error occurs in your application:

A potentially dangerous Request.Form value was detected from the client

Description

Microsoft .NET Framework causes this due to enhanced security features (request validation). Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest="false" in the Page directive or in the configuration section of Web.config. Note that if you are using .NET 4.0 or higher, you will also need to set requestValidationMode="2.0". However, it is strongly recommended that your application explicitly check all inputs if you use these settings.

Solution

Step 1:  Locate the ASP.NET settings in:

<Application Folder>\Web.config

Step 2: Set the value of validateRequest attribute of pages element to false.

<pages validateRequest="false" />

Step 3: (Only for .NET 4.0 and higher) Add the requestValidationMode attribute with the value of 2.0 to the httpRuntime element.

<httpRuntime maxRequestLength="10240" requestValidationMode="2.0" />

Additional information on this topic can be found at:

http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=26147

See Also

Part IX:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages