在Asp.Net Core 2.0中使用AllowHtml从数据库生成网页 [英] Generate web page from Database using AllowHtml in Asp.Net Core 2.0
问题描述
我有一个使用Asp.Net 4.61的应用程序,在其中我从数据库字段Description中读取html,并用它来填充我的应用程序中的页面.我通过用[AllowHtml]
标记属性Description来做到这一点.
I have an application use Asp.Net 4.61 in which I read html from a database field Description and use it to populate my a page in my application. I do this by marking the property Description with [AllowHtml]
.
在我的Asp.Net Core 2.0应用程序中,我收到一条错误,指出找不到程序集引用或指令.
In my Asp.Net Core 2.0 app, I get an error that the assembly reference or directive is not found.
我有2个问题-希望以后我能够更好地回答这样的问题:
I have 2 questions - that will hopefully enable me to better answer questions such as this in the future:
- 是否可以搜索文档/站点来查看AllowHtml是否为 在Core 2.0中
- 如果我想使用一种更好/更安全的方法,应该使用
通过从我的数据库中读取而不是用
[AllowHtml]
装饰字段/属性来填充网页?
- Is there a document/site that I could search to see if AllowHtml is in Core 2.0
- Is there a better/more secure way that I should use if I want to
populate web pages by reading from my database than decorating the field/property with
[AllowHtml]
?
推荐答案
您不再需要[AllowHtml],因为没有人拒绝ASP.NET Core 2.0中的HTML:
You don't need [AllowHtml] anymore, because nobody denies HTML in ASP.NET Core 2.0:
相反,防止跨站点脚本编写
这篇关于在Asp.Net Core 2.0中使用AllowHtml从数据库生成网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!