ASP.NET MVC: How to allow some HTML mark-up in Html Encoded content?
Posted
by Dr. Zim
on Stack Overflow
See other posts from Stack Overflow
or by Dr. Zim
Published on 2010-03-29T05:00:55Z
Indexed on
2010/03/29
5:03 UTC
Read the original article
Hit count: 486
asp.net-mvc
|htmlencode
Is there some magic existing code in MVC 2 to Html.Encode() strings and allow certain html markup, like paragraph marks and breaks? (coming from a Linq to SQL database field)
A horrible code example to achieve the effect:
Html.Encode(Model.fieldName).Replace("<br />", "<br />")
What would be really nice is to overload something and pass to it an array (or object) full of allowed html tags.
© Stack Overflow or respective owner