Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="http://stackoverflow.com">stackoverflow.com</a>
- <a href="alert('hacked!');">stackoverflow.com</a>
- /// <summary>
- /// returns "safe" URL, stripping anything outside normal charsets for URL
- /// </summary>
- public static string SanitizeUrl(string url)
- {
- return Regex.Replace(url, @"[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]", "");
- }
Add Comment
Please, Sign In to add comment