SHARE
TWEET

Untitled

a guest Apr 26th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected void Application_Error()
  2.         {
  3.             var exception = Server.GetLastError();
  4.  
  5.             Logger.Fatal("Eskn.Iom : Application_Error() : Exception", exception);
  6.  
  7.             var httpException = exception as HttpException;
  8.  
  9.             Response.Clear();
  10.             Server.ClearError();
  11.  
  12.             // Nastavime default status code
  13.             Response.StatusCode = (int)HttpStatusCode.BadRequest;
  14.  
  15.             // Default route data
  16.             var routeData = new RouteData();
  17.             routeData.Values["controller"] = "Error";
  18.             routeData.Values["action"] = "General";
  19.             routeData.Values["exception"] = exception;
  20.  
  21.             if (httpException != null)
  22.             {
  23.                 Response.StatusCode = httpException.GetHttpCode();
  24.                 switch (Response.StatusCode)
  25.                 {
  26.                     case 404:
  27.                         routeData.Values["action"] = "NotFound";
  28.                         break;
  29.                 }
  30.             }
  31.  
  32.             // Avoid IIS7 getting in the middle
  33.             Response.TrySkipIisCustomErrors = true;
  34.  
  35.             // Vykoname response v contexte ErrorController
  36.             IController errorController = new ErrorController();
  37.             var rc = new RequestContext(new HttpContextWrapper(Context), routeData);
  38.             errorController.Execute(rc);
  39.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top