using System; using System.Diagnostics; using System.Web; namespace MESws { public class Global : HttpApplication { #region Component Designer Generated Code public Global() : base() { // This call is required by the Component Designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call } // Required by the Component Designer private System.ComponentModel.IContainer components; // NOTE: The following procedure is required by the Component Designer // It can be modified using the Component Designer. // Do not modify it using the code editor. [DebuggerStepThrough()] private void InitializeComponent() { components = new System.ComponentModel.Container(); } #endregion public void Application_Start(object sender, EventArgs e) { // 啟動應用程式時引發 // funClearLoginInfo(Session.SessionID.ToString, True) } public void Session_Start(object sender, EventArgs e) { // 啟動工作階段時引發 funAddLoginInfo(Session.SessionID.ToString()); } public void Application_BeginRequest(object sender, EventArgs e) { // 於每一個要求開始時引發 } public void Application_AuthenticateRequest(object sender, EventArgs e) { // 嘗試驗證使用時引發 } public void Application_Error(object sender, EventArgs e) { // 發生錯誤時引發 try { EventLog.WriteEntry("MES Web Service", Server.GetLastError().Message, EventLogEntryType.Error, 9001); } catch (Exception ex) { } finally { Server.ClearError(); } } public void Session_End(object sender, EventArgs e) { // 於工作階段結束時引發 // funClearLoginInfo(Session.SessionID.ToString) } public void Application_End(object sender, EventArgs e) { // 於應用程式結束時引發 // funClearLoginInfo(Session.SessionID.ToString, True) } private void funAddLoginInfo(string tmpSessionID) { DateTime LoginTime; string strSQL; var kc = new iMESUserManager.clsUSRLoginInfo(); LoginTime = DateTime.Now; try { kc.AddLoginInfo(tmpSessionID); } catch (Exception ex) { throw; } // New Exception("wsUSR: Add Login Info " & ex.Message) finally { kc = null; } } } }