Bulb Flash:- Setting a Dangerous Cookie on the Browser!!

During a recent assignment we were trying to set an xml string in the browser cookie. The string actually being a security token had a combination of signatures and unicode characters which the browser did not seem to like too much:-)

So after we set the cookie,every time i would browse the solution i was greeted by a A potentially dangerous Request.Form value was detected from the client message and i couldn’t browse any further. Seems its .NETs way of making sure no one is trying to use malicious code to hack his way into your application..

If you are sure you want this cookie then make this change in your web.config and you will be fine!

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

and

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

Hope this bulb flash saves you some time and gray cells!!

Until Next time!

Cennest!!

Advertisements