开发者

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

开发者 https://www.devze.com 2023-03-28 22:48 出处:网络
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 th

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

精彩评论

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

关注公众号