May 12, 2014 by Nitesh

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


When posting HTML characters to an ASP.Net page, we normally get this error as – “A potentially dangerous Request.Form value was detected from the client in“. This post explains how to resolve this problem. To resolve this problem on a single page, you can set the “validateRequest” property of a page to false as shown below.

 < %@ Page Title="PotentialDangerous Page" ValidateRequest="false" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="PotentialDangerous.aspx.cs" Inherits="TestProject.PotentialDangerous"%>

In case you want to set it for the entire application, you can set the property for all pages under System.Web section in web.config file of the application as below.

&nbsp;< pages validateRequest = "false" />

The above mentioned solution works for solutions that are not targeting .Net 4.0 and higher. If you are using .Net 4.0 or higher, you need to add another setting in your web.config file under the <system.web> node as below.

&nbsp;&lt; httpRuntime requestValidationMode="2.0" /&gt;

In case you want this to be restricted only on a specific page of your website and not the rest of the website, you should put the following under <configuration> tab –

  <location path="Admin/MyFile.aspx">
    <system .web>
      <pages validateRequest="false"></pages>
      <httpruntime requestValidationMode="2.0"></httpruntime>

Hope this helps! Keep learning and sharing! Cheers!


Support us!

If you like this site please help and make click on any of these buttons!

Powered by WordPress Popup