You may get "A potentially dangerous Request.QueryString value was detected from the client" after upgrading to ASP.NET 4

I was upgradting one of the DNN portals to ASP.NET 4.After Upgrading completed and when i configured it to run under asp.net 4 in iis, I started to get that exception on every postback.

The mentioned exception is happening because in ASP.NET 4, the request validation is now being called for every asp.net resource like web services and other httphandlers.As a result, you may get that exception even if you turned off the RequestValidation via: <pages validateRequest="false" .... section.

This is one of the breaking changes that were mentioned here.

 So the solution is to set the new HttpRuntime "RequestValidationMode" property to "2.0" and it should take care of that exception.

<httpRuntime requestValidationMode="2.0" />

8 Comments

Comments have been disabled for this content.