Global.asax.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using CP.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. using System.Web.Routing;
  8. namespace CP.Kjh
  9. {
  10. public class MvcApplication : System.Web.HttpApplication
  11. {
  12. protected void Application_Start()
  13. {
  14. AreaRegistration.RegisterAllAreas();
  15. RouteConfig.RegisterRoutes(RouteTable.Routes);
  16. //500 筛选器
  17. FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  18. //日志记录
  19. LogHelper.SetConfig(new System.IO.FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
  20. }
  21. protected void Application_Error(object sender, EventArgs e)
  22. {
  23. //Exception lastError = Server.GetLastError();
  24. //if (lastError != null)
  25. //{
  26. // string strExceptionMessage = string.Empty;
  27. // HttpException httpError = lastError as HttpException;
  28. // if (httpError != null)
  29. // {
  30. // int httpCode = httpError.GetHttpCode();
  31. // if (httpCode == 400 || httpCode == 404)
  32. // {
  33. // Response.StatusCode = 404;
  34. // Server.ClearError();
  35. // return;
  36. // }
  37. // }
  38. // Response.StatusCode = 500;
  39. // Server.ClearError();
  40. //}
  41. }
  42. }
  43. }