I use tinyMCE to allow users to stylize text in text areas.
I have a property
[AllowHtml] Description {get;set;}
And everything works fine. But if use write something like this:
<div>not closed tag
This break my whole page. How to prevent this situation?
I use this to display text:
@Html.Raw(Model.Description)
AllowHtmlis only going to permit certain special characters to be posted. This will not validate your markup.It can be a security issue loading user generated markup onto the page. Your validator would want to strip out certain tags like
script.Many sites use an iframe to show user generated markup content to avoid this issue.