The following is a reference fragment: The following are the referenced contents: #region///Filter HTML,JS,CSS code <summary> Filter HTML,JS,CSS Code </summary> <param name= "HTML" > Parameters passed in </param> <returns></returns> public static string Checkstr (string html) { System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex (@ "<script[\s\s]+</ Script *> ", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex (@ "href *= *[\s\s]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex (@ "no[\s\s]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex (@ "<iframe[\s\s]+</ IFrame *> ", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex (@ "<frameset[\s\s]+</ Frameset *> ", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex6 = new System.Text.RegularExpressions.Regex (@ "\]+\>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex7 = new System.Text.RegularExpressions.Regex (@ "</p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex8 = new System.Text.RegularExpressions.Regex (@ "<p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Text.RegularExpressions.Regex regex9 = new System.Text.RegularExpressions.Regex (@ "<[^>]*>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); html = regex1. Replace (HTML, ""); Filtration <script></script> Labeling html = regex2. Replace (HTML, ""); Filter Href=javascript: (<A>) Properties html = regex3. Replace (HTML, "_disibledevent="); Filter other controls on ... Event html = regex4. Replace (HTML, ""); Filter iframe html = regex5. Replace (HTML, ""); Filtration Frameset html = regex6. Replace (HTML, ""); Filtration Frameset html = regex7. Replace (HTML, ""); Filtration Frameset html = regex8. Replace (HTML, ""); Filtration Frameset html = regex9. Replace (HTML, ""); html = HTML. Replace ("", ""); html = HTML. Replace ("</strong>", ""); html = HTML. Replace ("<strong>", ""); return HTML; } #endregion #region///Filter p/p code <summary> Filter p/p Code </summary> <param name= "HTML" > Parameters passed in </param> <returns></returns> public static string Inputstr (string html) { html = HTML. Replace (@ "\]+\>", ""); html = HTML. Replace (@ "<p>", ""); html = HTML. Replace (@ "</p>", ""); return HTML; } #endregion
<summary> Intercepting strings </summary> <param name= "str" ></param> <param name= "Length" ></param> <returns></returns> Protected string GetLength (string str, int length) { string strr = str; if (str. Length > Length) { STRR = str. Substring (0, length) + "..."; } return STRR; } |