Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string strip_dangerous_tags(string text_with_tags)
- {
- string s = Regex.Replace(text_with_tags,
- @"<script", "<scrSAFEipt", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"</script", "</scrSAFEipt", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"<object", "<obSAFEject", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"</object", "</obSAFEject", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"<embed", "<emSAFEbed", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"</embed", "</emSAFEbed", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onabort", "onSAFEabort", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onblur", "onSAFEblur", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onchange", "onSAFEchange", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onclick", "onSAFEclick", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"ondblclick", "onSAFEdblclick", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onerror", "onSAFEerror", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onfocus", "onSAFEfocus", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onkeydown", "onSAFEkeydown", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onkeypress", "onSAFEkeypress", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onkeyup", "onSAFEkeyup", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onload", "onSAFEload", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onmousedown", "onSAFEmousedown", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onmousemove", "onSAFEmousemove", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onmouseout", "onSAFEmouseout", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onmouseup", "onSAFEmouseup", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onmouseup", "onSAFEmouseup", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onreset", "onSAFEresetK", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onresize", "onSAFEresize", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onselect", "onSAFEselect", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onsubmit", "onSAFEsubmit", RegexOptions.IgnoreCase);
- s = Regex.Replace(s, @"onunload", "onSAFEunload", RegexOptions.IgnoreCase);
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment