c# - 如何使用 C# 清理 html 页面上的输入?

标签 c# html-sanitizing antixsslibrary

是否有用于清理 html 页面输入的库或可接受的方法?

在本例中,我有一个仅包含姓名、电话号码和电子邮件地址的表单。

代码必须是 C#。

例如:

"<script src='bobs.js'>John Doe</script>"应该变成 "John Doe"

最佳答案

我们正在使用 HtmlSanitizer .Net 库,其中:

也在 NuGet

关于c# - 如何使用 C# 清理 html 页面上的输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/188870/

相关文章:

c# - Eric Lippert 和 Neal Gafter C# 谜题

c# - 如何将 OpenID 结合 Forms 身份验证添加到 MVC

c# - 使用 lambda 表达式调用字典的键对象的方法

security - Angular 2 : sanitizing HTML stripped some content with div id - this is bug or feature?

asp.net - 在存储到数据库之前或渲染之前清理 HTML? (ASP.NET 中的 AntiXSS 库)

c# - CaSTLe Windsor激活错误IController,key "home"

Python html-sanitizer 允许使用 img 标签

javascript - XSS - 可以通过删除 "<"来清理用户输入吗?

javascript - IE8 window.open 名称 - 不喜欢 JavaScript 编码?

XSS - SQL 注入(inject) - Owasp、AntiXss 与 Microsoft 反跨站脚本库