Skip to content

Instantly share code, notes, and snippets.

@wsky
Created August 1, 2012 08:34
Show Gist options
  • Save wsky/3225045 to your computer and use it in GitHub Desktop.
Save wsky/3225045 to your computer and use it in GitHub Desktop.
IsXmlHttpRequest
public static bool IsXmlHttpRequest(this HttpRequestBase request)
{
var header = request.Headers["X-Requested-With"];
return !string.IsNullOrEmpty(header) && header.ToLower().IndexOf("xmlhttp") >= 0;
}
@wsky
Copy link
Author

wsky commented Aug 1, 2012

Request.IsAjaxRequest()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment