开发者

Text written by tinnymce is not displayed well formatted in asp.net mvc

I use Tinymce t开发者_StackOverflow中文版o edit article body in my asp.net mvc application. I also put [ValidateInput(false)] on 'Edit' Action result, and I get no errors, but When I want to show the article body to user, even by using Html.Raw(article.Body), it show raw html tags and not the formaytted text. Here is a example of out put:

<p><span style="text-decoration: underline;"><strong>dsadad asdsadad asdsadadad</strong></span></p> 

ps: I use AntiXss library.


It looks like AntiXss is encoding the HTML so < will become &lt;. To decode it back to HTML, try this:

@Html.Raw(HttpUtility.HtmlDecode(article.Body))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜