Tuesday, June 22, 2010

ASP.NET Validate Request with .NET 4.0 – some breaking news

From old days -

1.  if you want to store HTML in DB – may be script you encode and store.

2. While post back you will get “potentially dangerous Request.Form value was detected” – To fix this you go ahead and make validateRequest=false on your page.

3. With .NET 4.0 this will not work Because this is now in the BeginRequest phase of a HTTP request, pages with validationRequest=”false”  will still get the dreaded message

Fix?

Set requestValidationMode=”2.0″ in which case the page setting will apply.

Put <httpRuntime requestValidationMode=”2.0″ /> in your web.config’s <syste.web> section

good article can be found here

No comments: