Asp.net-mvc – Allow HTML in text boxes

asp.netasp.net-mvc

I'm using ASP.NET MVC.

How can I allow users to enter HTML into a textbox?
I'm seting validaterequest to false and still getting this error:

A potentially dangerous Request.Form value was detected from the client (Summary="<a>").

I know its not recommended etc, but it's for internal use.

Best Answer

If you are using DataAnnotations on your model, you can open up a single property to allow HTML by using the AllowHtml attribute. Note that this attribute is in the System.Web.Mvc namespace.

This would probably be recommended over setting ValidateInput to false at the action level.