Asp – A potentially dangerous Request.Form with ASP MVC

asp.net-mvc

I have recently upgraded a project of mine from one of the beta builds of MVC to the full version.

I am getting the yellow screen of death on one of my inputs "A potentially dangerous Request.Form yada yada".

So I tried edting the pages validateRequest attribute, that didnt work.

Then I tried adding

[ValidateInput(false)]

To the offending action, but when I try and build it says the attribute doesn't exist.

So what do I do?

Best Answer

Incidentally, a breaking change in MVC 2 / ASP.NET 4 means [ValidateInput(false)] won't work unless you add the following to the <system.web> part of your web.config file:

<httpRuntime requestValidationMode="2.0" />