日期:2014-05-17  浏览次数:20431 次

如何在后台过滤 script 标签
RT
 求思路,最好是能有model~

------解决方案--------------------
C# code

Htmlstring = Regex.Replace(Htmlstring, @"(?is)<script\b[^>]*>(.*?)</script>", string.Empty, RegexOptions.IgnoreCase);

------解决方案--------------------
string js = @"asdf
<script>
alert
</script>
asdfads
<Script type=''>alert<script>asdfasdf
";
js= Regex.Replace(js,@"\<\s*script(\s|.)*?script\s*\>","",RegexOptions.IgnoreCase);