Chris James
Chris James

Reputation: 11701

A potentially dangerous Request.Form with ASP 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?

Upvotes: 1

Views: 2426

Answers (2)

James McCormack
James McCormack

Reputation: 9934

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" />

Upvotes: 4

Mathias F
Mathias F

Reputation: 15891

It works at my site.

Can you try with a new plain website? I had some other strange behaviours (strongly typed views did not work), when I converted webs from beta to R1. Starting fresh and copying over the files to the new web always worked at the end.

Upvotes: 1

Related Questions