
294
|
Chapter 14: The HttpContext Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Notes
Often, you will use the copy of Application from the Page class. However, for
objects not derived from
Page (for instance, HttpHandlers and HttpModules) this
is a convenient way to access the Application state.
Do not confuse this property, which returns an instance of type HttpAppli-
cationState, with the ApplicationInstance property, which returns an instance of
type HttpApplication.
ApplicationInstance
Context.ApplicationInstance = HttpApplication
HttpApplication
= Context.ApplicationInstance
Returns or sets the current HttpApplication object.
Parameter
HttpApplication
An HttpApplication object that will receive or set the value of the
ApplicationInstance property.
Notes
Generally, you do not need to use the HttpApplication object, since the proper-
ties it exposes are usually available through other objects. One exception is when
accessing all the methods that allow you to add event handlers for this request.
Cache
HttpCache = Context.Cache
Returns an instance of the Cache class.
Parameter
HttpCache
An Object variable of type
Cache.
Example
The example retrieves an instance of the Cache class into a local variable and then
adds a value to the cache:
Sub Application_BeginRequest( )
Dim myCache As Cache
myCache = Context.Cache
myCache.Add("Test", "Test", ...