The ASP Application object is supported by ASP.NET through HttpApplicationState Class and HttpApplication Class.
Application object of ASP.NET is related to the manipulation of information about
entire web application for all clients on the server.
A single instance of an HttpApplicationState class is created the first time a client requests any URL resource from within a particular ASP.NET application virtual directory. In other words, an HttpApplicationState class is not a global application object. A reference to each instance of the System.Web.HttpResponseState class is then exposed via the intrinsic Application object.
An HttpApplicationState class defines the methods, properties, and events that are common to all application objects in an ASP.NET application. This class is the base class for applications that are defined by the user in the Global.asax file. Instances of the HttpApplication class are created in the ASP.NET infrastructure, not by the user directly. One instance of the HttpApplication class is used to process many requests in its lifetime. However, it can process only one request at a time. Thus, member variables can be used to store per-request data. ASP.NET introduces the unique Application_OnStart and Application_OnEnd "events" for compatibility with classic ASP. These "events" are executed only once in the lifetime of an application and not for every application instance. Therefore, if you change non-static members in these methods, you affect only one application instance and not all instances.
Method |
Description |
Add(String, Object) |
Adds a new object to the HttpApplicationState collection. |
BaseAdd(String, Object) |
Adds an entry with the specified key and value into the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseClear() |
Removes all entries from the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGet(Int32) |
Gets the value of the entry at the specified index of the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGet(String) |
Gets the value of the first entry with the specified key from the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGetAllKeys() |
Returns a String array that contains all the keys in the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGetAllValues() |
Returns an Object array that contains all the values in the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGetAllValues(Type) |
Returns an array of the specified type that contains all the values in the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseGetKey(Int32) |
Gets the key of the entry at the specified index of the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseHasKeys() |
Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not null. (Inherited from NameObjectCollectionBase) |
BaseRemove(String) |
Removes the entries with the specified key from the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseRemoveAt(Int32) |
Removes the entry at the specified index of the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseSet(Int32, Object) |
Sets the value of the entry at the specified index of the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
BaseSet(String, Object) |
Sets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
Clear() |
Removes all objects from an HttpApplicationState collection. |
Contents.Remove |
Remove
or delete an item from the Contents collection of Application object. |
Contents.RemoveAll |
Remove
or delete all items from the Contents collection of Application object. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get(Int32) |
Gets an HttpApplicationState object by numerical index. |
Get(String) |
Gets an HttpApplicationState object by name. |
GetEnumerator() |
Returns an enumerator that iterates through the NameObjectCollectionBase. (Inherited from NameObjectCollectionBase) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetKey(Int32) |
Gets an HttpApplicationState object name by index. |
GetObjectData(SerializationInfo, StreamingContext) |
Implements the ISerializable interface and returns the data needed to serialize the NameObjectCollectionBase instance. (Inherited from NameObjectCollectionBase) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
Lock() |
Locks access to an HttpApplicationState variable to facilitate access synchronization. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
OnDeserialization(Object) |
Implements the ISerializable interface and raises the deserialization event when the deserialization is complete. (Inherited from NameObjectCollectionBase) |
Remove(String) |
Removes the named object from an HttpApplicationState collection. |
RemoveAll() |
Removes all objects from an HttpApplicationState collection. |
RemoveAt(Int32) |
Removes an HttpApplicationState object from a collection by index. |
Set(String, Object) |
Updates the value of an object in an HttpApplicationState collection. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Unlock() |
Unlocks access to an HttpApplicationState variable to facilitate access synchronization. |
Method |
Description |
AddOnAcquireRequestStateAsync(BeginEventHandler, EndEventHandler) |
Adds the specified AcquireRequestState event to the collection of asynchronous AcquireRequestState event handlers for the current request. |
AddOnAcquireRequestStateAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified AcquireRequestState event to the collection of asynchronous AcquireRequestState event handlers for the current request. |
AddOnAuthenticateRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified AuthenticateRequest event to the collection of asynchronous AuthenticateRequest event handlers for the current request. |
AddOnAuthenticateRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified AuthenticateRequest event to the collection of asynchronous AuthenticateRequest event handlers for the current request. |
AddOnAuthorizeRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified AuthorizeRequest event to the collection of asynchronous AuthorizeRequest event handlers for the current request. |
AddOnAuthorizeRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified AuthorizeRequest event to the collection of asynchronous AuthorizeRequest event handlers for the current request. |
AddOnBeginRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified BeginRequest event to the collection of asynchronous BeginRequest event handlers for the current request. |
AddOnBeginRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified BeginRequest event to the collection of asynchronous BeginRequest event handlers for the current request. |
AddOnEndRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified EndRequest event to the collection of asynchronous EndRequest event handlers for the current request. |
AddOnEndRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified EndRequest event to the collection of asynchronous EndRequest event handlers for the current request. |
AddOnLogRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified LogRequest event to the collection of asynchronous LogRequest event handlers for the current request. |
AddOnLogRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified LogRequest event to the collection of asynchronous LogRequest event handlers for the current request. |
AddOnMapRequestHandlerAsync(BeginEventHandler, EndEventHandler) |
Adds the specified MapRequestHandler event to the collection of asynchronous MapRequestHandler event handlers for the current request. |
AddOnMapRequestHandlerAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified MapRequestHandler event to the collection of asynchronous MapRequestHandler event handlers for the current request. |
AddOnPostAcquireRequestStateAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostAcquireRequestState event to the collection of asynchronous PostAcquireRequestState event handlers for the current request. |
AddOnPostAcquireRequestStateAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostAcquireRequestState event to the collection of asynchronous PostAcquireRequestState event handlers for the current request. |
AddOnPostAuthenticateRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostAuthenticateRequest event to the collection of asynchronous PostAuthenticateRequest event handlers for the current request. |
AddOnPostAuthenticateRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostAuthorizeRequest event to the collection of asynchronous PostAuthorizeRequest event handlers for the current request. |
AddOnPostAuthorizeRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostAuthorizeRequest event to the collection of asynchronous PostAuthorizeRequest event handlers for the current request. |
AddOnPostAuthorizeRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostAuthorizeRequest to the collection of asynchronous PostAuthorizeRequest event handlers for the current request. |
AddOnPostLogRequestAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostLogRequest event to the collection of asynchronous PostLogRequest event handlers for the current request. |
AddOnPostLogRequestAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostLogRequest event to the collection of asynchronous PostLogRequest event handlers for the current request. |
AddOnPostMapRequestHandlerAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostMapRequestHandler event to the collection of asynchronous PostMapRequestHandler event handlers for the current request. |
AddOnPostMapRequestHandlerAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostMapRequestHandler event to the collection of asynchronous PostMapRequestHandler event handlers for the current request. |
AddOnPostReleaseRequestStateAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostReleaseRequestState event to the collection of asynchronous PostReleaseRequestState event handlers for the current request. |
AddOnPostReleaseRequestStateAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostReleaseRequestState event to the collection of asynchronous PostReleaseRequestState event handlers for the current request. |
AddOnPostRequestHandlerExecuteAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostRequestHandlerExecute event to the collection of asynchronous PostRequestHandlerExecute event handlers for the current request. |
AddOnPostRequestHandlerExecuteAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostRequestHandlerExecute event to the collection of asynchronous PostRequestHandlerExecute event handlers for the current request. |
AddOnPostResolveRequestCacheAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostResolveRequestCache event to the collection of asynchronous PostResolveRequestCache event handlers for the current request. |
AddOnPostResolveRequestCacheAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostResolveRequestCache event to the collection of asynchronous PostResolveRequestCache event handlers for the current request. |
AddOnPostUpdateRequestCacheAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PostUpdateRequestCache event to the collection of asynchronous PostUpdateRequestCache event handlers for the current request. |
AddOnPostUpdateRequestCacheAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PostUpdateRequestCache event to the collection of asynchronous PostUpdateRequestCache event handlers for the current request. |
AddOnPreRequestHandlerExecuteAsync(BeginEventHandler, EndEventHandler) |
Adds the specified PreRequestHandlerExecute event to the collection of asynchronous PreRequestHandlerExecute event handlers for the current request. |
AddOnPreRequestHandlerExecuteAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified PreRequestHandlerExecute event to the collection of asynchronous PreRequestHandlerExecute event handlers for the current request. |
AddOnReleaseRequestStateAsync(BeginEventHandler, EndEventHandler) |
Adds the specified ReleaseRequestState event to the collection of asynchronous ReleaseRequestState event handlers for the current request. |
AddOnReleaseRequestStateAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified ReleaseRequestState event to the collection of asynchronous ReleaseRequestState event handlers for the current request. |
AddOnResolveRequestCacheAsync(BeginEventHandler, EndEventHandler) |
Adds the specified ResolveRequestCache event handler to the collection of asynchronous ResolveRequestCache event handlers for the current request. |
AddOnResolveRequestCacheAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified ResolveRequestCache event handler to the collection of asynchronous ResolveRequestCache event handlers for the current request. |
AddOnUpdateRequestCacheAsync(BeginEventHandler, EndEventHandler) |
Adds the specified UpdateRequestCache event to the collection of asynchronous UpdateRequestCache event handlers for the current request. |
AddOnUpdateRequestCacheAsync(BeginEventHandler, EndEventHandler, Object) |
Adds the specified UpdateRequestCache event to the collection of asynchronous UpdateRequestCache event handlers for the current request. |
CompleteRequest() |
Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. |
Dispose() |
Disposes the HttpApplication instance. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
GetVaryByCustomString(HttpContext, String) |
Provides an application-wide implementation of the VaryByCustom property. |
Init() |
Executes custom initialization code after all event handler modules have been added. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Event |
Description |
AcquireRequestState |
Occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request. |
AuthenticateRequest |
Occurs when a security module has established the identity of the user. |
AuthorizeRequest |
Occurs when a security module has verified user authorization. |
BeginRequest |
Occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request. |
Disposed |
Occurs when the application is disposed. |
EndRequest |
Occurs as the last event in the HTTP pipeline chain of execution when ASP.NET responds to a request. |
Error |
Occurs when an unhandled exception is thrown. |
LogRequest |
Occurs just before ASP.NET performs any logging for the current request. |
MapRequestHandler |
Occurs when the handler is selected to respond to the request. |
PostAcquireRequestState |
Occurs when the request state (for example, session state) that is associated with the current request has been obtained. |
PostAuthenticateRequest |
Occurs when a security module has established the identity of the user. |
PostAuthorizeRequest |
Occurs when the user for the current request has been authorized. |
PostLogRequest |
Occurs when ASP.NET has completed processing all the event handlers for the LogRequest event. |
PostMapRequestHandler |
Occurs when ASP.NET has mapped the current request to the appropriate event handler. |
PostReleaseRequestState |
Occurs when ASP.NET has completed executing all request event handlers and the request state data has been stored. |
PostRequestHandlerExecute |
Occurs when the ASP.NET event handler (for example, a page or an XML Web service) finishes execution. |
PostResolveRequestCache |
Occurs when ASP.NET bypasses execution of the current event handler and allows a caching module to serve a request from the cache. |
PostUpdateRequestCache |
Occurs when ASP.NET finishes updating caching modules and storing responses that are used to serve subsequent requests from the cache. |
PreRequestHandlerExecute |
Occurs just before ASP.NET starts executing an event handler (for example, a page or an XML Web service). |
PreSendRequestContent |
Occurs just before ASP.NET sends content to the client. |
PreSendRequestHeaders |
Occurs just before ASP.NET sends HTTP headers to the client. |
ReleaseRequestState |
Occurs after ASP.NET finishes executing all request event handlers. This event causes state modules to save the current state data. |
ResolveRequestCache |
Occurs when ASP.NET finishes an authorization event to let the caching modules serve requests from the cache, bypassing execution of the event handler (for example, a page or an XML Web service). |
UpdateRequestCache |
Occurs when ASP.NET finishes executing an event handler in order to let caching modules store responses that will be used to serve subsequent requests from the cache. |
Application_OnEnd |
Event occurs on the end of the Application after all the Session_OnEnd event.
Available objects are Application Object and Server Object built-in objects. |
Application_OnStart |
Event occurs on the
start of the Application before the first Session_OnStart
event. Available objects are Application Object and Server Object built-in
objects. |