Perform Special Processing when Logging Out

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.
- Pooja Daga, Technical Support Engineer, Iron Speed, Inc.

March 22, 2006
Iron Speed Designer V3.2

Procedure
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.

About the Author
Pooja Daga
Technical Support Engineer, Iron Speed, Inc.

Pooja has experience developing Web applications using .NET technology. She started her career with PCS, a leading software services company headquartered in India and has been with Iron Speed since 2005.

Pooja holds an M.S. degree in Computer Application and a B.S. degree in Electrical engineering from Maharaja Sayajirao University in India.



  Privacy Statement