对于Application和SSession状态以及变量的处理可以在这个文件中处理,工程建立时没有这个文件可以从other里面添加;VS2005里面还有对于页面状态变量的处理,这里好像没有,不知道怎么搞,以后研究着看吧。
procedure Application_BeginRequest(sender: System.Object; e: EventArgs);
procedure Application_EndRequest(sender: System.Object; e: EventArgs);
这两个东东看上去很好玩啊!
unit Global; interface uses System.Collections, System.ComponentModel, System.Web, System.Web.SessionState; type TGlobal = class(System.Web.HttpApplication) {$REGION ‘Designer Managed Code‘} strict private procedure InitializeComponent; {$ENDREGION} strict protected procedure Application_Start(sender: System.Object; e: EventArgs); procedure Session_Start(sender: System.Object; e: EventArgs); procedure Application_BeginRequest(sender: System.Object; e: EventArgs); procedure Application_EndRequest(sender: System.Object; e: EventArgs); procedure Application_AuthenticateRequest(sender: System.Object; e: EventArgs); procedure Application_Error(sender: System.Object; e: EventArgs); procedure Session_End(sender: System.Object; e: EventArgs); procedure Application_End(sender: System.Object; e: EventArgs); private { Private Declarations } public constructor Create; end; implementation {$REGION ‘Designer Managed Code‘} ////// Required method for Designer support -- do not modify /// the contents of this method with the code editor. /// procedure TGlobal.InitializeComponent; begin end; {$ENDREGION} constructor TGlobal.Create; begin inherited; // // Required for Designer support // InitializeComponent; // // TODO: Add any constructor code after InitializeComponent call // end; procedure TGlobal.Application_Start(sender: System.Object; e: EventArgs); begin end; procedure TGlobal.Session_Start(sender: System.Object; e: EventArgs); begin Application.Lock; try if Application[‘NumUsers‘] = nil then Application[‘NumUsers‘] := System.Object(Integer(1)) else Application[‘NumUsers‘] := System.Object(Integer(Application[‘NumUsers‘])+1); finally Application.UnLock; end; end; procedure TGlobal.Application_BeginRequest(sender: System.Object; e: EventArgs); begin end; procedure TGlobal.Application_EndRequest(sender: System.Object; e: EventArgs); begin end; procedure TGlobal.Application_AuthenticateRequest(sender: System.Object; e: EventArgs); begin end; procedure TGlobal.Application_Error(sender: System.Object; e: EventArgs); begin end; procedure TGlobal.Session_End(sender: System.Object; e: EventArgs); begin Application.Lock; try if Application[‘NumUsers‘] <> nil then Application[‘NumUsers‘] := System.Object(Integer(Application[‘NumUsers‘])-1) else Application[‘NumUsers‘] := System.Object(Integer(0)); finally Application.UnLock; end; end; procedure TGlobal.Application_End(sender: System.Object; e: EventArgs); begin end; end.