Reputation: 793
I needs to find a way to allow html tags in MVC2 model binding.
In MVC3 there is a way but MVC2 I dont know. can you help?
In MVC3
[AllowHtml]
public string SomeProperty{ get; set; }
I need some alternate method for AllowHtmlAttribute in mvc2
Upvotes: 0
Views: 160
Reputation: 1038930
You could use the [ValidateInput(false)]
attribute on the controller action:
[ValidateInput(false)]
[HttpPost]
public ActionResult SomeAction(MyViewModel model)
{
...
}
This will disable input validation for all properties of the model. There's no way in ASP.NET MVC 2 to do this per property - it has to be for the entire request.
Upvotes: 1