将HTML作为纯文本(Getting HTML as plain text)

我使用Tinymce(富文本编辑器)从页面输入HTML作为输入,并将输入保存到SQL服务器,在检索数据表单数据库并将其传递给视图时,所有html标记和内容都显示为纯文本。

我正在使用asp.net核心MVC。

I am taking HTML as input from a page using Tinymce(Rich Text editor), and saving input to SQL server , While retrieving the data form database and passing it to view ,all html tags and content are showing as plain text.

I am using asp.net core MVC.

最满意答案

这是你想要使用Html.Raw()的地方

Html.Raw()用于呈现您传递给它的HTML字符串作为页面上的标记。

This is where you would want to use Html.Raw()

Html.Raw() with render the HTML string you pass to it as markup on the page.

更多推荐