#region RemoveUnsafeString 过滤脚本注入和SQL注入字符
/// <summary>
/// 过滤脚本注入和SQL注入字符
/// </summary>
/// <param name="targetString">目标字符串</param>
/// <returns>过滤后的字符串</returns>
public static string RemoveUnsafeString(string targetString)
{
if (string.IsNullOrEmpty(targetString))
{
return targetString;
}
targetString = Regex.Replace(targetString, @"<script[^>]*?>.*?</script>", string.Empty, RegexOptions.IgnoreCase);
return Regex.Replace(targetString, @"[-|;|,|\/|\(|\)|\[|\]|\}|\{|%|@|\*|!|\']", string.Empty, RegexOptions.IgnoreCase);
}
#endregion