Global2.asax.exclude 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <%@ Application Language="C#" %>
  2. <%@ Import Namespace="Castle.ActiveRecord" %>
  3. <%@ Import Namespace="Castle.ActiveRecord.Framework.Config" %>
  4. <%@ Import Namespace="BizCom" %>
  5. <%@ Import Namespace="SiteCore" %>
  6. <%@ Import Namespace="Utils" %>
  7. <%@ Import Namespace="System.Threading" %>
  8. <%@ Import Namespace="System.IO" %>
  9. <%@ Import Namespace="System.Data" %>
  10. <%@ Import Namespace="System.Data.SqlClient" %>
  11. <%@ Import Namespace="System.Web" %>
  12. <%@ Import Namespace="System.Security.Cryptography" %>
  13. <%@ Import Namespace="Newtonsoft.Json" %>
  14. <script runat="server">
  15. void Application_Start(object sender, EventArgs e)
  16. {
  17. //log4net.Config.XmlConfigurator.Configure();
  18. // Code that runs on application startup
  19. InPlaceConfigurationSource source = new InPlaceConfigurationSource();
  20. System.Collections.Generic.IDictionary<string, string> properties = new System.Collections.Generic.Dictionary<string, string>();
  21. properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
  22. properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle");
  23. properties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
  24. properties.Add("show_sql", "true");
  25. properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
  26. string conn = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
  27. properties.Add("connection.connection_string", conn);
  28. source.Add(typeof(ActiveRecordBase), properties);
  29. source.IsRunningInWebApp = true;
  30. //IConfigurationSource source =ConfigurationManager.GetSection("activerecord") as IConfigurationSource;
  31. Type[] acTypes = new[]
  32. {
  33. typeof(XUser),
  34. typeof(XModular),
  35. typeof(CeErpModular),
  36. typeof(CeErpUser),
  37. typeof(CeErpPost),
  38. //typeof(CeErpPersonPost),
  39. typeof(CeErpOrderFormData),
  40. typeof(CeErpUserInfo),
  41. typeof(CeErpOrganization),
  42. typeof(CeErpShop),
  43. typeof(CeErpSupplier),
  44. typeof(CeErpProduct),
  45. typeof(CeErpProductHour),
  46. typeof(CeErpSupplierProduct),
  47. typeof(CeErpTrade),
  48. typeof(CeErpTradeOrder),
  49. typeof(CeErpTradeCell),
  50. typeof(CeErpTradeLog),
  51. typeof(CeErpTradeResponsible),
  52. typeof(CeErpTradeRefund),
  53. typeof(CeErpTradeSample),
  54. typeof(CeErpBill),
  55. typeof(CeErpReturnCash),
  56. typeof(CeErpExpressInfo),
  57. typeof(CeErpUserPost),
  58. typeof(CeErpZhangDan),
  59. typeof(CeErpInvoicingInfo),
  60. typeof(CeErpCustomer),
  61. typeof(CeErpTmcLog),
  62. typeof(XPermission),
  63. typeof(XLog),
  64. typeof(Log_Login),
  65. typeof(CEErpPrintModel),
  66. typeof(CeErpDesignerBill),
  67. typeof(CeErpDesignerBillLog),
  68. typeof(CeErpProductPrice),
  69. typeof(CeErpToManagement),
  70. typeof(CeErpSpecialRefund),
  71. typeof(CeErpMessageAPI),
  72. typeof(CeErpDesignerFinishRateNew),
  73. typeof(CeErpMessageTip)
  74. };
  75. ActiveRecordStarter.Initialize(source, acTypes);
  76. }
  77. void Application_End(object sender, EventArgs e)
  78. {
  79. // 在应用程序关闭时运行的代码
  80. // 解决应用池回收问题
  81. //System.Threading.Thread.Sleep(5000);
  82. ////http://localhost:911/login.aspx
  83. //string strUrl = CommonHelper.GetPrePath() + "login.aspx";
  84. //System.Net.HttpWebRequest _HttpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strUrl);
  85. //System.Net.HttpWebResponse _HttpWebResponse = (System.Net.HttpWebResponse)_HttpWebRequest.GetResponse();
  86. //System.IO.Stream _Stream = _HttpWebResponse.GetResponseStream();//得到回写的字节流
  87. }
  88. void Application_BeginRequest(Object sender, EventArgs e)
  89. {
  90. }
  91. void Application_Error(object sender, EventArgs e)
  92. {
  93. // Code that runs when an unhandled error occurs
  94. //if (config.Instance.Site.SpiderIp.Contains(CommonHelper.ClientIP))return;
  95. //SyLog.WriteLog(Server.GetLastError());
  96. }
  97. void Session_Start(object sender, EventArgs e)
  98. {
  99. // Code that runs when a new session is started
  100. }
  101. void Session_End(object sender, EventArgs e)
  102. {
  103. // Code that runs when a session ends.
  104. // Note: The Session_End event is raised only when the sessionstate mode
  105. // is set to InProc in the Web.config file. If session mode is set to StateServer
  106. // or SQLServer, the event is not raised.
  107. }
  108. </script>