比如我插入内容为<strong>12345</strong>,数据表里显示的是12345,那些标记没了。。再比如插入<img src="http:/xxxxx.jpg"> ,居然报错,好像是双引号的问题,请教解决方法。
解决方案 »
- GridView 中读出一张数据库表,其中一列是另一张表的关键字,想读取出来
- 父画面迁移后关闭,子画面也关闭
- 如何令DetailsView的Header那一行消失?
- 当对象的属性是一个自定义对象时,怎么绑定?
- 怎么在Datagrid里添加Checkbox(求救!!)
- <customErrors mode= "Off "/> 配置了不显示错误
- asp.net2.0+AJAX1.0网站发布后ajax功能失效?高手帮帮忙!急!
- 未能加载文件或程序集“Ant.Cache”或它的某一个依赖项。拒绝访问。怎么办?
- 关于下拉列表
- 为什么<a href="测试下载.zip"></a> 一点就说无法显视呢?
- 下面的代码该怎么调试啊
- 后台控制前台css问题
public static string NoHTML(string strHtml)
{
strHtml= Regex.Replace(strHtml, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase); strHtml= Regex.Replace(strHtml, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"-->", "", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"<!--.*", "", RegexOptions.IgnoreCase); strHtml= Regex.Replace(strHtml, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
strHtml= Regex.Replace(strHtml, @"&#(\d+);", "", RegexOptions.IgnoreCase); strHtml.Replace("<", "");
strHtml.Replace(">", "");
strHtml.Replace("\r\n", "");
strHtml= HttpContext.Current.Server.HtmlEncode(strHtml).Trim(); return strHtml;
}
在这个里面加上 ValidateRequest="false" 就OK了 这个在aspx页面的最上方