Global.asax 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. HttpContext.Current.Response.Write(new JsonResult(JsonStatus.otherError).ToJson());
  28. }
  29. Server.ClearError();
  30. }
  31. void Session_Start(object sender, EventArgs e)
  32. {
  33. // 在新会话启动时运行的代码
  34. }
  35. void Session_End(object sender, EventArgs e)
  36. {
  37. // 在会话结束时运行的代码。
  38. // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
  39. // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer
  40. // 或 SQLServer,则不引发该事件。
  41. }
  42. </script>