清除HTML中的特殊字符

   /// <summary>
        /// 清楚HTML中的特殊字符
        /// </summary>
        /// <param name="Htmlstring"></param>
        /// <returns></returns>
        public static string DelHTML(string Htmlstring)
        {
            if (string.IsNullOrEmpty(Htmlstring))
                return "";
            //特殊的字符
            Htmlstring = Htmlstring.Replace("&", "");
            Htmlstring = Htmlstring.Replace("<", "");
            Htmlstring = Htmlstring.Replace(">", "");
            Htmlstring = Htmlstring.Replace("*", "");
            Htmlstring = Htmlstring.Replace("-", "");
            Htmlstring = Htmlstring.Replace("?", "");
            Htmlstring = Htmlstring.Replace(",", "");
            Htmlstring = Htmlstring.Replace("/", "");
            Htmlstring = Htmlstring.Replace(";", "");
            Htmlstring = Htmlstring.Replace("*/", "");
            Htmlstring = Htmlstring.Replace("\r\n", "");
            Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();

return Htmlstring;
        }

上一篇:Master Note: Troubleshooting ORA-1548 error (Doc ID 1577988.1)


下一篇:Windows 服务器开通防火墙后,IISFTP和Serv U开通的FTP账号不能登录