Skip to content

Instantly share code, notes, and snippets.

@geoffreysmith
Created November 1, 2013 14:48
Show Gist options
  • Save geoffreysmith/7266517 to your computer and use it in GitHub Desktop.
Save geoffreysmith/7266517 to your computer and use it in GitHub Desktop.
protected void Application_Error(object sender, EventArgs e)
{
var exception = Server.GetLastError();
Server.ClearError();
var routeData = new RouteData();
routeData.Values.Add("controller", "Error");
routeData.Values.Add("action", "Index");
Sitecore.Diagnostics.Log.Error("Application_Error invoked", exception, this);
routeData.Values.Add("statusCode",
exception.GetType() == typeof (HttpException)
? ((HttpException) exception).GetHttpCode()
: 500);
IController controller = new ErrorController();
controller.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment