Himall验证Web帮助类是否是get请求、是否是post请求、是否是Ajax请求、获得查询字符串中的值
迪丽瓦拉
2024-02-19 12:42:49
0

 ///


        /// 是否是get请求
        ///

        ///
        public static bool IsGet()
        {
            return HttpContext.Current.Request.HttpMethod == "GET";
        }

        ///


        /// 是否是post请求
        ///

        ///
        public static bool IsPost()
        {
            return HttpContext.Current.Request.HttpMethod == "POST";
        }

        ///


        /// 是否是Ajax请求
        ///

        ///
        public static bool IsAjax()
        {
            return HttpContext.Current.Request.Headers["X-Requested-With"] == "XMLHttpRequest";
        }

      

相关内容