views:

841

answers:

2

.NET 4 broke ValidateRequest=“false” for some reason.

The solution is -- just put <httpRuntime requestValidationMode="2.0" /> into your web.config file.

The problem with that solution is that it breaks support for .NET 2.0!

IIS refuses to accept unknown attributes in web.config. Also I don't like the all or nothing nature of this.

Can I set requestValidationMode (or in some other way disable request validation) for a single page that needs it? Without breaking backwards compatibility of web.config with 2.0?

+1  A: 

I just put this in my web.config in the system.web node.

<httpRuntime requestValidationMode="2.0" />
Mike
I guess that might mess up the 2.0 support then in your web.config though.
Mike
Yes, that's what the question is about. It breaks 2.0. And it is blanket for entire app.
MK
A: 

OK, looks like this can't be done and I can just escape the data easily, but I think this was a legitimate question -- at least to make a note here that this can't be done.

MK