简体   繁体   中英

ValidateInputAttribute bug in VS 2010 RC / ASP.NET MVC 2.0?

Am I doing something wrong here?

I have a text area on a view and am posting back the html contents. In VS 2008 and MVC 1.0 the following code successfully prevents input validation:

[HttpPost]
[ValidateInput(false)]
public ActionResult Index(int? id)
{
    return View();
}

If I execute this code in VS 2010 / MVC 2.0 I always get this error:

A potentially dangerous Request.Form value was detected from the client (body="
").

Any ideas?

Maybe this will help: Request Validation - ASP.NET MVC 2

Try adding this to your page directive:

ValidateRequest="false"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM