0 out of 1 rated this helpful - Rate this topic

HttpContextBase Class

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

System.Object
  System.Web.HttpContextBase
    System.Web.HttpContextWrapper

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
public abstract class HttpContextBase : IServiceProvider

The HttpContextBase type exposes the following members.

  Name Description
Protected method HttpContextBase Initializes the class for use by an inherited class instance. This constructor can only be called by an inherited class.
Top
  Name Description
Public property AllErrors When overridden in a derived class, gets an array of errors (if any) that accumulated when an HTTP request was being processed.
Public property Application When overridden in a derived class, gets the HttpApplicationState object for the current HTTP request.
Public property ApplicationInstance When overridden in a derived class, gets or sets the HttpApplication object for the current HTTP request.
Public property Cache When overridden in a derived class, gets the Cache object for the current application domain.
Public property CurrentHandler When overridden in a derived class, gets the IHttpHandler object that represents the handler that is currently executing.
Public property CurrentNotification When overridden in a derived class, gets a RequestNotification value that indicates the HttpApplication event that is currently processing.
Public property Error When overridden in a derived class, gets the first error (if any) that accumulated when an HTTP request was being processed.
Public property Handler When overridden in a derived class, gets or sets the IHttpHandler object that is responsible for processing the HTTP request.
Public property IsCustomErrorEnabled When overridden in a derived class, gets a value that indicates whether custom errors are enabled for the current HTTP request.
Public property IsDebuggingEnabled When overridden in a derived class, gets a value that indicates whether the current HTTP request is in debug mode.
Public property IsPostNotification When overridden in a derived class, gets a value that indicates whether an HttpApplication event has finished processing.
Public property Items When 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 property PreviousHandler When overridden in a derived class, gets the IHttpHandler object for the parent handler.
Public property Profile When overridden in a derived class, gets the ProfileBase object for the current user profile.
Public property Request When overridden in a derived class, gets the HttpRequest object for the current HTTP request.
Public property Response When overridden in a derived class, gets the HttpResponse object for the current HTTP response.
Public property Server When overridden in a derived class, gets the HttpServerUtility object that provides methods that are used when Web requests are being processed.
Public property Session When overridden in a derived class, gets the HttpSessionState object for the current HTTP request.
Public property SkipAuthorization When 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 property Timestamp When overridden in a derived class, gets the initial timestamp of the current HTTP request.
Public property Trace When overridden in a derived class, gets the TraceContext object for the current HTTP response.
Public property User When overridden in a derived class, gets or sets security information for the current HTTP request.
Top
  Name Description
Public method AddError When overridden in a derived class, adds an exception to the exception collection for the current HTTP request.
Public method ClearError When overridden in a derived class, clears all errors for the current HTTP request.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetGlobalResourceObject(String, String) When overridden in a derived class, gets an application-level resource object based on the specified ClassKey and ResourceKey properties.
Public method GetGlobalResourceObject(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 method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetLocalResourceObject(String, String) When overridden in a derived class, gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.
Public method GetLocalResourceObject(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 method GetSection When overridden in a derived class, gets the specified configuration section of the current application's default configuration.
Public method GetService When overridden in a derived class, returns an object for the current service type.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method RemapHandler When overridden in a derived class, specifies a handler for the request.
Public method RewritePath(String) When overridden in a derived class, rewrites the URL by using the specified path.
Public method RewritePath(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 method RewritePath(String, String, String) When overridden in a derived class, rewrites the URL by using the specified path, path information, and query string information.
Public method RewritePath(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 method SetSessionStateBehavior When overridden in a derived class, sets the type of session state behavior that is required to support an HTTP request.
Public method ToString Returns 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.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ