
298
|
Chapter 14: The HttpContext Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Code that does not have access to the properties of the Page class includes
HttpHandlers and HttpModules, as well as global.asax. One common reason for
using Context.Response is to write cookies in an HttpModule.
Session
HttpSessionState = Context.Session
Returns the HttpSession object for the current request.
Parameters
HttpSessionState
An HttpSessionState object to receive the current session.
Notes
This property is provided for applications other than ASP.NET pages (where the
Page.Session property is normally used to retrieve the HttpSessionState object).
Code that does not have access to the properties of the
Page class includes HttpHan-
dlers and HttpModules, as well as global.asax. When using Context.Session in the
Application event handlers of global.asax, Session is not available in the Applica-
tion BeginRequest event, but can be used in, for instance, the Application_
PreRequestHandlerExecute event.
SkipAuthorization
Boolean = Context.SkipAuthorization
Context.SkipAuthentication = Boolean
Sets or returns a flag indicating whether the URLAuthorization module will skip
the authorization check. The default is
False.
Parameter
Boolean
A Boolean variable returning or setting the flag regarding authorization
checks.
Example
The following example retrieves ...