Fix for ‘A potentially dangerous Request.Form value was detected from the client’ Error

When you access one of your ASP.NET web pages, if you get an error message that says something in the lines of ‘A potentially dangerous Request.Form value was detected from the client’, then you are most likely passing < or > in the querystring parameters. asp-net-a-potentially-dangerous-request-form-value-detected-client

Allegedly Microsoft introduced this check in ASP.NET 1.1 to prevent scripting attacks. So how do you fix this ?

Fix the ‘A potentially dangerous Request.Form value was detected…’ Error

  • Open the .aspx page in a text editor or in Visual Studio 2003.
  • In the Page directive, add the following
validatePageRequest=”false”

Example:

<%@ Page language=”c#” Codebehind=”Software.aspx.cs” AutoEventWireup=”false” Inherits=”Setup.Software” validatePageRequest=”false”%>

  • Save and close the .aspx file. This should fix it.
  • This fix is only for that individual page. If you wanted to make this default for all your pages, then add the following in your <system.web> section of your web.config file.
<system.web>

<pages validateRequest=”false” />

</system.web>

Related : Caveats and Consequences of  validateRequest

Leave a Reply