且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在asp.net中阻止HTTP代码

更新时间:2023-02-16 09:53:04

我想您想阻止您的用户输入
I guess you want to prevent your users from entering something like
<a href="http://www.spammer.com">Great Spam</a> 


进入页面的某些文本文件.
您可以尝试以下操作:
-过滤掉任何<>通过JavaScript
-过滤掉任何<>在后面的代码中或将其更改为& lt;等
-尝试使用正则表达式进行更精细的解析以检测链接


into some text fileds of your pages.
There are some things you could try:
- filter out any <> by JavaScript
- filter out any <> in the code behind or change them to &lt; etc.
- try some more elaborate parsing with regular expressions to detect links