You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.7 KiB

4 years ago
4 years ago
4 years ago
  1. using Business.Configuration;
  2. using Common.Helper;
  3. using Common.Model;
  4. using Newtonsoft.Json;
  5. using Repository.DAO.Account;
  6. using System;
  7. using System.Web;
  8. using System.Web.Optimization;
  9. using System.Web.Routing;
  10. namespace JMEAgentSystem
  11. {
  12. public class Global : HttpApplication
  13. {
  14. private void Application_Start(object sender, EventArgs e)
  15. {
  16. // Code that runs on application startup
  17. RouteConfig.RegisterRoutes(RouteTable.Routes);
  18. BundleConfig.RegisterBundles(BundleTable.Bundles);
  19. var container = AutoFacContainer.DIContainer();
  20. AutoFacContainer.DIContainer();
  21. }
  22. protected void Application_Error(object sender, EventArgs e)
  23. {
  24. //return;
  25. HttpException err = Server.GetLastError() as HttpException;
  26. DbResponse dr = new DbResponse();
  27. if (err != null)
  28. {
  29. var page = HttpContext.Current.Request.Url.ToString();
  30. dr = new AccountRepo().LogError(err, page, GetStatic.GetUser());
  31. }
  32. Server.ClearError();
  33. var url = GetStatic.GetVirtualDirName() + "/WebPages/Error";
  34. ResponseWithUrl res = new ResponseWithUrl()
  35. {
  36. Id = dr.Id,
  37. Msg = dr.Msg,
  38. ResponseCode = dr.ResponseCode,
  39. Url = url
  40. };
  41. Response.ContentType = "text/plain";
  42. string json = JsonConvert.SerializeObject(res);
  43. Response.Write(json);
  44. Response.End();
  45. ////Response.Redirect(url + "?id=" + dr.Id);
  46. //Server.Transfer(url + "?id=" + dr.Id);
  47. }
  48. }
  49. }