• 过滤sql匹配符号 防止sql注入


    /// <summary> /// 过滤sql中非法字符
            
    /// </summary>
           
    /// <param name="value">要过滤的字符串 </param>
           
    /// <returns>string </returns>
            public static string Filter(string value)
            {
               
    if (string.IsNullOrEmpty(value)) return string.Empty;
                value
    = Regex.Replace(value, @";", string.Empty);
                value
    = Regex.Replace(value, @"'", string.Empty);
                value
    = Regex.Replace(value, @"&", string.Empty);
                value
    = Regex.Replace(value, @"%20", string.Empty);
                value
    = Regex.Replace(value, @"--", string.Empty);
                value
    = Regex.Replace(value, @"==", string.Empty);
                value
    = Regex.Replace(value, @" <", string.Empty);
                value
    = Regex.Replace(value, @">", string.Empty);
                value
    = Regex.Replace(value, @"%", string.Empty);

               
    return value;
            }
  • 相关阅读:
    常用Git命令清单
    上海金瑢信息有限公司面试
    上海视频面试
    bootstrp-3.0
    B站小姐姐面试分享2
    B站小姐姐分享第一次电话面试
    Array.from()方法就是将一个类数组对象或者可遍历对象转换成一个真正的数组。
    findIndex
    es5,es6
    es6数组去重
  • 原文地址:https://www.cnblogs.com/smallfa/p/1611010.html
Copyright © 2020-2023  润新知