Global.asax 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. //定义报表系统是否启用,1:启用,0:未启用;
  14. Application.Add("newReport", 1);
  15. }
  16. void Application_End(object sender, EventArgs e)
  17. {
  18. // 在应用程序关闭时运行的代码
  19. }
  20. void Application_Error(object sender, EventArgs e)
  21. {
  22. // 在出现未处理的错误时运行的代码
  23. Exception error = Server.GetLastError().GetBaseException();
  24. if (error != null)
  25. {
  26. //记录日志
  27. Logger.Error(error);
  28. //输出错误信息
  29. HttpContext.Current.Response.Write(new JsonResult(JsonStatus.otherError).ToJson());
  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>