专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅
禁用HTML最简单的方法是直接禁用html标签而不用移除它们. 可以使用Replace()函数. 例如:strText = Replace(strText, \"<script\", \"&lt;script\", 1, -1, 1)或者直接禁用所有的html: strText = Replace(strText, \"<\", \"&lt;\")这样做虽然很安全,但显得不够友好.(用户提交的文本会变得难以阅读) [阅读全文] [PDF]
/// 除去所有在HTML元素中标记 public static string StripHTML(string strHtml) { string strOutput=strHtml; Regex regex = new Regex(@\"<[^>]+>|]+>\"); strOutput = regex.Replace(strOutput,\"\"); return strOutput; } [阅读全文] [PDF]
1 共2条 分1页