Remote XSS Black List - CSharp System

CSharp examples for System:String Format

Description

Remote XSS Black List

Demo Code


using System.Xml.Linq;
using System.Web;
using System.Text.RegularExpressions;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  ww  w .j  a va2 s.c o  m

public class Main{
        #region Anti XSS

        public static string RemoteXSSBlackList(this string htmltext)
        {
            XDocument html = XDocument.Parse(htmltext);
            foreach (var script in html.Descendants("script"))
            {
                script.ToString();
            }

            string temp = htmltext.Replace("<script>", " ");
            return temp;
        }
}

Related Tutorials