Skip to content

Instantly share code, notes, and snippets.

@wsky
Created August 1, 2012 08:34
Show Gist options
  • Select an option

  • Save wsky/3225045 to your computer and use it in GitHub Desktop.

Select an option

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

wsky commented Aug 1, 2012

Copy link
Copy Markdown
Author

Request.IsAjaxRequest()

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