C# 判断当前请求是GET还是POST


方法一:

HttpContext.Current.Request.RequestType == "POST";   //当前请求为:POST 

HttpContext.Current.Request.RequestType == "GET";   //当前请求为:GET

方法二:

if(Request.ServerVariables["REQUEST_METHOD"] =="POST")

}     //当前请求为:POST 

if(Request.ServerVariables["REQUEST_METHOD"] =="GET")

}      //当前请求为:GET

C