是标准的html 空格表示
单纯的 是对于文本框 状态的空格.
单纯的 是对于文本框 状态的空格.
解决方案 »
- 一个真的很简单的问题
- 如何从一个文件中提取数据更新到数据库中
- ??????如何直接运行安装.cab文件??????
- 真是急死人呐,在线等乐! hchxxzx(NET?摸到一点门槛),你在线不?
- 一条框架页面跳转的语句
- 请教:“请求验证过程检测到有潜在危险的客户端输入值”这样的错误
- 验证控件不起作用了
- 在IIS中配置后,连接数据库出现问题
- SQL索引问题。郁闷啊?CREATE UNIQUE CLUSTERED INDEX ncptcd_main ON ncptcd(partcode,subcode)
- asp.net在什么时候生成__doPostBack()方法?
- vs2005发布出错,没分了,希望大家能帮帮我,谢谢了
- 求sql查询语句
this.TextBox5.Text = NoHTML(row.Cells[4].Text.Trim()); /// <summary>
/// 使用正则表达式删除用户输入中的html,和script内容
/// </summary>
/// <param name="Htmlstring">输入内容</param>
/// <returns>清理后的文本</returns>
public static string NoHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</" + "script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
Htmlstring = Htmlstring.Replace("<", "<");
Htmlstring = Htmlstring.Replace(">", ">");
Htmlstring = Htmlstring.Replace("\r\n", "");
Htmlstring = Htmlstring;
return Htmlstring;
}