〖在做一些网站(特别是BBS之类)时,经常...... 在做一些网站(特别是BBS之类)时,经常会有充许用户输入html样式代码,却禁止脚本的运行的需求, 以达到丰富网页样式,禁止恶意代码的运行。 当然不能用 HtmlEncode 和 HtmlDecode 方法,因为这样连基本的html代码会被禁止掉。 我在网上搜索,也没有找到好的解决办法,倒是收集了一些脚本攻击的实例: 1. ",System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:",System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=",System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@" |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 01:34 , Processed in 0.174640 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.