Global.asax 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <%@ Application Language="C#" %>
  2. <%@ Import Namespace="Curtain.DataAccess" %>
  3. <%@ Import Namespace="Curtain.Log" %>
  4. <%@ Import Namespace="DK.XuWei.WebMes" %>
  5. <script runat="server">
  6. void Application_Start(object sender, EventArgs e)
  7. {
  8. // 在应用程序启动时运行的代码
  9. string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  10. DataAccess.DefaultParameterType = SQLParameterType.CDA;
  11. DataAccess.DefaultDataBaseType = Curtain.DataAccess.DataBaseType.Oracle;
  12. DataAccess.DefaultConnectionString = connStr;
  13. }
  14. void Application_End(object sender, EventArgs e)
  15. {
  16. // 在应用程序关闭时运行的代码
  17. }
  18. void Application_Error(object sender, EventArgs e)
  19. {
  20. // 在出现未处理的错误时运行的代码
  21. Exception error = Server.GetLastError().GetBaseException();
  22. if (error != null)
  23. {
  24. //记录日志
  25. Logger.Error(error);
  26. //输出错误信息
  27. //2022-11-15 冯林勇 出现错误不弹出日志
  28. //HttpContext.Current.Response.Write(new JsonResult(JsonStatus.otherError).ToJson());
  29. //2022-11-15 冯林勇 出现错误不弹出日志
  30. }
  31. Server.ClearError();
  32. }
  33. void Session_Start(object sender, EventArgs e)
  34. {
  35. // 在新会话启动时运行的代码
  36. }
  37. void Session_End(object sender, EventArgs e)
  38. {
  39. // 在会话结束时运行的代码。
  40. // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
  41. // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer
  42. // 或 SQLServer,则不引发该事件。
  43. }
  44. </script>