ASP.NET中判断请求是不是为Ajax请求一法

ASP.NET中判断请求是否为Ajax请求一法判断是否为ajaxRequest 在http请求头中查找是否包含X-Requested-With

ASP.NET中判断请求是否为Ajax请求一法

判断是否为ajaxRequest 在http请求头中查找是否包含X-Requested-With,并且值为XMLHttpRequest

string sheader = Request.header["x-microsoftajax"];bool isAjaxRequest = (sheade != null && sheader == "Delta-true") ? true : false;

?