Export (0) Print
Expand All

HttpContextBase Class

Serves as the base class for classes that contain HTTP-specific information about an individual HTTP request.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public ref class HttpContextBase abstract : IServiceProvider

The HttpContextBase type exposes the following members.

  NameDescription
Protected methodHttpContextBaseInitializes the class for use by an inherited class instance. This constructor can only be called by an inherited class.
Top

  NameDescription
Public propertyAllErrorsWhen overridden in a derived class, gets an array of errors (if any) that accumulated when an HTTP request was being processed.
Public propertyApplicationWhen overridden in a derived class, gets the HttpApplicationState object for the current HTTP request.
Public propertyApplicationInstanceWhen overridden in a derived class, gets or sets the HttpApplication object for the current HTTP request.
Public propertyCacheWhen overridden in a derived class, gets the Cache object for the current application domain.
Public propertyCurrentHandlerWhen overridden in a derived class, gets the IHttpHandler object that represents the handler that is currently executing.
Public propertyCurrentNotificationWhen overridden in a derived class, gets a RequestNotification value that indicates the HttpApplication event that is currently processing.
Public propertyErrorWhen overridden in a derived class, gets the first error (if any) that accumulated when an HTTP request was being processed.
Public propertyHandlerWhen overridden in a derived class, gets or sets the IHttpHandler object that is responsible for processing the HTTP request.
Public propertyIsCustomErrorEnabledWhen overridden in a derived class, gets a value that indicates whether custom errors are enabled for the current HTTP request.
Public propertyIsDebuggingEnabledWhen overridden in a derived class, gets a value that indicates whether the current HTTP request is in debug mode.
Public propertyIsPostNotificationWhen overridden in a derived class, gets a value that indicates whether an HttpApplication event has finished processing.
Public propertyItemsWhen overridden in a derived class, gets a key/value collection that can be used to organize and share data between a module and a handler during an HTTP request.
Public propertyPreviousHandlerWhen overridden in a derived class, gets the IHttpHandler object for the parent handler.
Public propertyProfileWhen overridden in a derived class, gets the ProfileBase object for the current user profile.
Public propertyRequestWhen overridden in a derived class, gets the HttpRequest object for the current HTTP request.
Public propertyResponseWhen overridden in a derived class, gets the HttpResponse object for the current HTTP response.
Public propertyServerWhen overridden in a derived class, gets the HttpServerUtility object that provides methods that are used when Web requests are being processed.
Public propertySessionWhen overridden in a derived class, gets the HttpSessionState object for the current HTTP request.
Public propertySkipAuthorizationWhen overridden in a derived class, gets or sets a value that specifies whether the UrlAuthorizationModule object should skip the authorization check for the current request.
Public propertyTimestampWhen overridden in a derived class, gets the initial timestamp of the current HTTP request.
Public propertyTraceWhen overridden in a derived class, gets the TraceContext object for the current HTTP response.
Public propertyUserWhen overridden in a derived class, gets or sets security information for the current HTTP request.
Top

  NameDescription
Public methodAddErrorWhen overridden in a derived class, adds an exception to the exception collection for the current HTTP request.
Public methodClearErrorWhen overridden in a derived class, clears all errors for the current HTTP request.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetGlobalResourceObject(String, String)When overridden in a derived class, gets an application-level resource object based on the specified ClassKey and ResourceKey properties.
Public methodGetGlobalResourceObject(String, String, CultureInfo)When overridden in a derived class, gets an application-level resource object based on the specified ClassKey and ResourceKey properties, and on the CultureInfo object.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLocalResourceObject(String, String)When overridden in a derived class, gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.
Public methodGetLocalResourceObject(String, String, CultureInfo)When overridden in a derived class, gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object.
Public methodGetSectionWhen overridden in a derived class, gets the specified configuration section of the current application's default configuration.
Public methodGetServiceWhen overridden in a derived class, returns an object for the current service type.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemapHandlerWhen overridden in a derived class, specifies a handler for the request.
Public methodRewritePath(String)When overridden in a derived class, rewrites the URL by using the specified path.
Public methodRewritePath(String, Boolean)When overridden in a derived class, rewrites the URL by using the specified path and a value that specifies whether the virtual path for server resources is modified.
Public methodRewritePath(String, String, String)When overridden in a derived class, rewrites the URL by using the specified path, path information, and query string information.
Public methodRewritePath(String, String, String, Boolean)When overridden in a derived class, rewrites the URL by using the specified path, path information, query string information, and a value that specifies whether the client file path is set to the rewrite path.
Public methodSetSessionStateBehaviorWhen overridden in a derived class, sets the type of session state behavior that is required to support an HTTP request.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The HttpContextBase class is an abstract class that contains the same members as the HttpContext class. The HttpContextBase class enables you to create derived classes that are like the HttpContext class, but that you can customize and that work outside the ASP.NET pipeline. When you perform unit testing, you typically use a derived class to implement members with customized behavior that fulfills the scenario you are testing.

The HttpContextWrapper class derives from the HttpContextBase class. The HttpContextWrapper class serves as a wrapper for the HttpContext class. At run time, you typically use an instance of the HttpContextWrapper class to call members on the HttpContext object.

.NET Framework

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft