How can I allow a user to input HTML into a particular field using ASP.net MVC.
I have a long form with many fields that get mapped to this complex object in the controller.
I would like to make one field (the description) allow HTML which I will preform my own sanitation on at a later point.
Add the following attribute the action (post) in the controller that you want to allow HTML for:
Edit: As per Charlino comments:
In your web.config set the validation mode used. See MSDN:
Edit Sept 2014: As per sprinter252 comments:
You should now use the
[AllowHtml]
attribute. See below from MSDN: