According to this link, now we can use Request.Unvalidated to access a raw value of a form field wihout triggering request validation (and see dreadful error message A potentially dangerous Request.Form...). Unfortunately I could not get it work.
Web.config
<httpRuntime targetFramework="4.5" requestValidationMode="4.5" />
A simple field in view model:
// [AllowHtml] - even I tried this, it still did not work :(
public string Description { get; set; }
And controller action:
[HttpPost]
public ActionResult Edit([Bind(Prefix = "Edit")] EditModel model)
{
string s = Request.Unvalidated.Form["Edit.Description"];
}
I still see error "A potentially dangerous Request.Form...", why? Tried google but there was no example with ASP.NET MVC.
Toolbox: I'm working with a ASP.NET MVC 4 project, targetting .NET 4.5, and VS2012.
Thanks,
UPDATE: Using AllowHtml with Description property fixed my problem, even don't need Request.Unvalidated. There is still an issue as I commented below in @webdeveloper's answer.