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

You get the 2nd comment!

  1. Charita Even says:

    not to mention my pals were checking the great recommendations from your site and at once developed an awful feeling I had not expressed respect to the website owner for those strategies. These boys are already for this reason warmed to read them and now have in fact been enjoying them. Appreciation for genuinely really accommodating as well as for deciding on this sort of remarkable subject matter most people are really desirous to be informed on. My personal honest regret for not saying thanks to sooner.

Leave a Reply