清理用户输入库.NET

发布于 2024-08-05 09:28:12 字数 342 浏览 11 评论 0原文

是否有一个 .Net 库,每个人都用它来验证/清理网站上的用户输入。似乎有很多帖子解释人们使用哪些正则表达式以及何时使用。虽然我确实喜欢经常重新发明轮子,但我会在用户输入时划清界限。

大多数情况下,我并不担心 SQL 注入,而是担心 html 输入和我无法想象的输入。它只会让我脸上露出微笑,因为它像这样工作:

    string sanitizedInput = InputSanitizer.SanitizeInput(input, SanitizeOption.RemoveHTML 
| SanitizeOption.RemoveSQL);

有人有这样的东西吗? (提前致谢)

Is there a .Net library which everyone uses to validate/cleanup user input from website. It seems like there are a lot of posts explaining which regex people use and when. While I do like to reinvent the wheel quite frequently I draw the line at user input.

Mostly I am not worried about SQL injection, but rather am concerned about html inputs and inputs which I cannot imagine. It would just put a smile on my face for it to work like this:

    string sanitizedInput = InputSanitizer.SanitizeInput(input, SanitizeOption.RemoveHTML 
| SanitizeOption.RemoveSQL);

Anyone have anything like this? (Thanks in advance)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

对你再特殊 2024-08-12 09:28:12

最新版本的 AntiXSS 具有 MS 内部使用的 HTML 清理功能。

The latest version of AntiXSS has HTML sanitization functions that MS use internally.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文