|
When a user logs out of an application, you may want to do some special processing.
You can do this in an "application-wide" page class. Each page class is defined in a hierarchy
sub-classed from the Page class of Microsoft .NET Framework.
For a page called "AddCustomersPage" in .NET Framework 1.1, the hierarchy is:
System.Web.UI.Page (Microsoft .NET Framework class)
BaseClasses.Web.UI.BasePage (Base Classes. Source code included.)
BaseApplicationPage (Application wide BasePage class.)
BaseAddCustomersPage (Regenerated when necessary. Do not modify.)
 AddCustomersPage (Customizable class. Created once. Never overwritten)
|
For a page called "AddCustomersPage" in .NET Framework 2.0, the hierarchy is:
System.Web.UI.Page (Microsoft .NET Framework class)
BaseClasses.Web.UI.BasePage (Base Classes. Source code included.)
BaseApplicationPage (Application wide BasePage class.)
AddCustomersPage (Customizable class. Created once. Never overwritten)
|
The BaseApplicationPage class allows you to modify the behavior of the System.Web.UI.Page or BaseClasses.Web.UI.BasePage across the entire application.
For .NET Framework 1.1, BaseApplicationPage is located in:
|
...\<AppFolder>\Shared\BaseApplicationPage.vb
|
For .NET Framework 2.0, BaseApplicationPage is located in:
|
...\<AppFolder>\App_Code\Shared\BaseApplicationPage.vb
|
You can override the OnApplicationEvent function at the Page class level.
C#
public override void OnApplicationEvent(BaseClasses.ApplicationEventArgs args)
{
if ((args.EventType) == BaseClasses.ApplicationEventArgs.EventTypes.LogOut)
{
// Do your special processing here. Note that redirecting to a
//page will not execute the logout method.
}
base.OnApplicationEvent(args);
}
|
Note: Make sure you call the base.OnApplicationEvent method.
Visual Basic .NET:
Public Overrides Sub OnApplicationEvent(ByVal args As BaseClasses.ApplicationEventArgs)
Select Case (args.EventType)
Case BaseClasses.ApplicationEventArgs.EventTypes.LogOut
‘Do your special processing here. Note that redirecting to a page will not execute the logout ‘method
End Select
MyBase.OnApplicationEvent(args)
End Sub
|
Note: Make sure you call the MyBase.OnApplicationEvent method.
|