views:

1106

answers:

4

I am getting this error in my ASP.NET MVC application where I am taking HTML input from a WYSIWYG so I don't want the content validated.

I have attempted the solution I found here but it seems to make no difference in my MVC application. I have also tried doing it in the web.config but again - no joy. Is this a bug in ASP.NET MVC or something?

+3  A: 

Just place this attribute: [ValidateInput(false)] on the action method on the controller that handles the form post.

pj.az109
+11  A: 

In MVC you would use the ValidateInput(false) attribute.

You then need to sanitize your inputs, e.g. with something like this.

Craig Stuntz
+2  A: 

use <httpRuntime requestValidationMode="2.0" /> in web config

Truegilly
http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/whitepapers/aspnet4/breaking-changes/#_TOC7
Mauricio Scheffer
this only applies to .NET 4
Mauricio Scheffer