Skip to content

Instantly share code, notes, and snippets.

@wsky
Created July 30, 2012 03:05
Show Gist options
  • Save wsky/3203858 to your computer and use it in GitHub Desktop.
Save wsky/3203858 to your computer and use it in GitHub Desktop.
Application_Error Ajax
var header = context.Request.Headers["X-Requested-With"];
if (!string.IsNullOrEmpty(header) && header.ToLower().IndexOf("xmlhttp") >= 0)
{
Server.ClearError();
Response.StatusCode = 400;
Response.Clear();
Response.Write(exception.Message);
Response.End();
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment