ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || RAM 
Search Site:

Home » ASP » Article

Application & Session Events in the Global.asax File

Article by: Jeff Anderson (9/24/2003)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: An introduction to the global.asax file and the application and sesion events that found there.
Viewed: 151455 times Rating (111 votes): 
 3.9 out of 5
 Rate this Article  Read Comments  Post Comments

Application & Session Events in the Global.asax File

Programmers familiar with ASP will know about the global.asa file. It's the place where application level events are handeled. The global.asax file is the ASP.Net equivalent and it can be found in the root directory of an ASP.Net application.

Here is the list of events you can call. By calling them you are actually overriding the event that is exposed by the HttpApplication base class.

As with traditional ASP, used to set up an application environment and only called when the application first starts.

This method occurs after _start and is used for initializing code.

This method is invoked before destroying an instance of an application.

This event is used to handle all unhandled exceptions in the application.

Again, like classic ASP, used to clean up variables and memory when an application ends.

This event is used when a client makes a request to any page in the application. It can be useful for redirecting or validating a page request.

After a request for a page has been made, this is the last event that is called.

This event occurs just before ASP.Net begins executing a handler such as a page or a web service. At this point, the session state is available.

This event occurs when the ASP.Net handler finishes execution.

This event occurs just before ASP.Net sends HTTP Headers to the client. This can be useful if you want to modify a header

This event occurs just before ASP.Net sends content to the client.

This event occurs when ASP.Net acquires the current state (eg. Session state) associated with the current request.

This event occurs after ASP.NET finishes executing all request handlers and causes state modules to save the current state data.

This event occurs when the identity of the current user has been established as valid by the security module .

This event occurs when the user has been authorized to access the resources of the security module .

As with classic ASP, this event is triggered when any new user accesses the web site.

As with classic ASP, this event is triggered when a user's session times out or ends. Note this can be 20 mins (the default session timeout value) after the user actually leaves the site.

Useful Links

CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Application & Session Events in the Global.asax File'
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP GetTempName
by Jeff Anderson
Use the GetTempName method to create a randomly generated temporary file on the server.
ASP Format Date and Time Script
by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
Email validation using Regular Expression
by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP.
Add or Subtract Hours in SQL or ASP using DateAdd
by Jeff Anderson
A beginners guide to using the SQL DATEADD function to add or subtract hours. Particularly useful when setting the time displayed on the ASP page to a different time zone (eg when the server is in the US, and the site is for a UK audience).
The asp:radiobutton and asp:radiobuttonlist control
by David Sussman, et al
In HTML, radio buttons are used when we need to make multiple sets of choices available, but we want the user to select only one of them.
The asp:checkbox and asp:checkboxlist control
by David Sussman, et al
Checkboxes are similar to radio buttons, and in HTML, they were used to allow multiple choices from a group of buttons.
Concatenate strings in sql
by Jeff Anderson
A brief introduction to concatenating strings in an sql query (using SQL server or access databases).
ASP FileExists
by Jeff Anderson
An introduction to the FileExistsMethod of the FileSystemObject

Recent Forum Threads
• Run a program both on windows and linux
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2

Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text

© Copyright 2001-2015