The potentially dangerous Request.Cookies value was detected by the client

Every time I open a website project / web project in Visual Studio 2010 and try to work in debug / debug mode (F5 / F11), I get this error: "A potentially dangerous Request.Cookies value was detected by the client . "

I installed VS 2010 SP1 a month ago, I'm not sure if this is related to this.

This happens with a newly created project and existing projects. Therefore, I can not start any project.

I set validaterequest on the page and in web.config, like most google search results sites, but I cannot get through this error.

Does anyone know what the problem is and how to solve this problem?

SET on PAGE:
<% @ Page validateRequest = "false"%>

SET in WEB.CONFIG:

<system.web> <pages validateRequest="false" /> </system.web> </br> 

</ Configuration>

Server error in application / WebApp.

The potentially dangerous Request.Cookies value was detected by the client (DNNPersonalization = ". After setting this value, you can disable request validation by setting validateRequest =" false "in the page directive or in the configuration section. However, it is highly recommended that your application explicitly checks everything inputs in this case.For more information see http://go.microsoft.com/fwlink/?LinkId=153133 .

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Cookies value was detected at the client (DNNPersonalization = "

Source Error:

An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the trace of the exception stack below.

Stack trace:

[HttpRequestValidationException (0x80004005): A potentially dangerous Request.Cookies value was detected at the client (DNNPersonalization = "


Version Information: Microsoft.NET Framework Version: 4.0.30319; ASP.NET Version: 4.0.30319.225

+4
source share
2 answers

Use

 <system.web> <httpRuntime requestValidationMode="2.0" /> </system.web> 

In your web.config

+14
source

You get this error when ASP.NET blocks sending html tags in GET / POST arguments and cookies to prevent script attacks. You can:

  • encode arguments / don't send html tags
  • Disable request validation

You can disable request validation for the entire site by adding to Web.config:

 <configuration> <system.web> <httpRuntime requestValidationMode="2.0" /> <pages validateRequest="false" /> </system.web> </configuration> 

To disable a separate page , add to Web.config:

 <configuration> <system.web> <httpRuntime requestValidationMode="2.0" /> </system.web> </configuration> 

and add the .aspx page:

 <%@ Page validateRequest="false" %> 

Additional information: http://www.asp.net/learn/whitepapers/request-validation

+4
source

All Articles