Search This Blog

Thursday 26 May 2016

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

A potentially dangerous Request.Form value was detected from the client
Server Error in '/' Application.


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


If you are getting above error, you need to do following changes in web.config or Page directive or both.

Step 1:-

Under <system.web> section, put following line to disable request validation whole site / all pages.

<pages validateRequest="false">

Or

You can use following under Page directive to disable request validation page specific.

ValidateRequest="false"

<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Demo.Default" %>

Step 2:-

If still you are getting the same error, you may need to do a little more (In .NET 4).

Go to under <system.web> section, put following line.
<httpRuntime requestValidationMode="2.0"/>

Note:-

The request validation feature in ASP.NET provides a certain level of default protection against cross site scripting (XSS).
Advisable, always avoid it because there is huge securities issue based on application nature.


No comments:

Post a Comment