Name
Context
Synopsis
HttpContext = Page.Context
Returns an HttpContext instance containing context information for the current HTTP request.
Parameters
-
HttpContext
A variable of type HttpContext that will receive the reference to the current HttpContext instance.
Example
The following code example uses the Context property to return the
name of the currently logged in user. This information is also
available from the User property of the Page
class, which is derived from the HttpContext associated with the
current request.
Sub Page_Load( ) Message.Text = "Currently logged in as: " & _ Context.User.Identity.Name End Sub
Notes
A common use of this property is to pass a reference to the
HttpContext for the current request to a business object that needs
access to the ASP.NET intrinsic objects (Request, Response, etc.). In
addition to providing access to the Application, Request, Response,
Server, and Session intrinsics, the HttpContext
class provides access to the Trace and User information for the
current HTTP request.
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.