HttpContextWrapper Class

Definition

Encapsulates the HTTP intrinsic object that contains HTTP-specific information about an individual HTTP request.

public ref class HttpContextWrapper : System::Web::HttpContextBase
public class HttpContextWrapper : System.Web.HttpContextBase
type HttpContextWrapper = class
    inherit HttpContextBase
Public Class HttpContextWrapper
Inherits HttpContextBase
Inheritance
HttpContextWrapper

Remarks

The HttpContextWrapper class derives from the HttpContextBase class and serves as a wrapper for the HttpContext class. This class exposes the functionality of the HttpContext class and also exposes the HttpContextBase type. The HttpContextBase class lets you replace the original implementation of the HttpContext class in your application with a custom implementation, such as when you perform unit testing outside the ASP.NET pipeline.

Constructors

HttpContextWrapper(HttpContext)

Initializes a new instance of the HttpContextWrapper class by using the specified context object.

Properties

AllErrors

Gets an array of errors (if any) that accumulated when an HTTP request was being processed.

AllowAsyncDuringSyncStages

Gets or sets a value that indicates whether asynchronous operations are allowed during parts of ASP.NET request processing when they are not expected.

AllowAsyncDuringSyncStages

When implemented in a derived class, gets or sets a value that indicates whether asynchronous operations are allowed during parts of ASP.NET request processing when they are not expected.

(Inherited from HttpContextBase)
Application

Gets the HttpApplicationState object for the current HTTP request.

ApplicationInstance

Gets or sets the HttpApplication object for the current HTTP request.

AsyncPreloadMode

Gets or sets an object that contains flags that pertain to asynchronous preload mode.

AsyncPreloadMode

When implemented in a derived class, gets or sets an object that contains flags that pertain to asynchronous preload mode.

(Inherited from HttpContextBase)
Cache

Gets the Cache object for the current application domain.

CurrentHandler

Gets the IHttpHandler object that represents the handler that is currently executing.

CurrentNotification

Gets a RequestNotification value that indicates the current HttpApplication event that is processing.

Error

Gets the first error (if any) that accumulated when an HTTP request was being processed.

Handler

Gets or sets the IHttpHandler object that is responsible for processing the HTTP request.

IsCustomErrorEnabled

Gets a value that indicates whether custom errors are enabled for the current HTTP request.

IsDebuggingEnabled

Gets a value that indicates whether the current HTTP request is in debug mode.

IsPostNotification

Gets a value that indicates whether an HttpApplication event has finished processing.

IsWebSocketRequest

Gets a value that indicates whether the request is an AspNetWebSocket request.

IsWebSocketRequest

When implemented in a derived class, gets a value that indicates whether the request is an AspNetWebSocket connection request.

(Inherited from HttpContextBase)
IsWebSocketRequestUpgrading

Gets a value that indicates whether the connection is upgrading from an HTTP connection to an AspNetWebSocket connection.

IsWebSocketRequestUpgrading

When implemented in a derived class, gets a value that indicates whether the connection is upgrading from an HTTP connection to an AspNetWebSocket connection.

(Inherited from HttpContextBase)
Items

Gets a key/value collection that can be used to organize and share data between a module and a handler during an HTTP request.

PageInstrumentation

Gets a reference to the page-instrumentation service instance for this request.

PageInstrumentation

When implemented in a derived class, gets a reference to the page-instrumentation service instance for this request.

(Inherited from HttpContextBase)
PreviousHandler

Gets the IHttpHandler object for the parent handler.

Profile

Gets the ProfileBase object for the current user profile.

Request

Gets the HttpRequestBase object for the current HTTP request.

Response

Gets the HttpResponseBase object for the current HTTP response.

Server

Gets the HttpServerUtilityBase object that provides methods that are used when Web requests are being processed.

Session

Gets the HttpSessionStateBase object for the current HTTP request.

SkipAuthorization

Gets or sets a value that specifies whether the UrlAuthorizationModule object should skip the authorization check for the current request.

ThreadAbortOnTimeout

Gets or sets a value that specifies whether the ASP.NET runtime should call Abort() on the thread that is servicing this request when the request times out.

ThreadAbortOnTimeout

When implemented in a derived class, gets or sets a value that specifies whether the ASP.NET runtime should call Abort() on the thread that is servicing this request when the request times out.

(Inherited from HttpContextBase)
Timestamp

Gets the initial timestamp of the current HTTP request.

Trace

Gets the TraceContext object for the current HTTP response.

User

Gets or sets security information for the current HTTP request.

WebSocketNegotiatedProtocol

Gets the negotiated protocol that was sent from the server to the client for an AspNetWebSocket request.

WebSocketNegotiatedProtocol

When implemented in a derived class, gets the negotiated protocol that was sent from the server to the client for an AspNetWebSocket connection.

(Inherited from HttpContextBase)
WebSocketRequestedProtocols

Gets the ordered list of protocols requested by the client.

WebSocketRequestedProtocols

When implemented in a derived class, gets the ordered list of protocols that were requested by the client.

(Inherited from HttpContextBase)

Methods

AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>)

Accepts an AspNetWebSocket request using the specified user function.

AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>)

When implemented in a derived class, accepts an AspNetWebSocket request using the specified user function.

(Inherited from HttpContextBase)
AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>, AspNetWebSocketOptions)

Accepts an AspNetWebSocket request using the specified user function and options object.

AcceptWebSocketRequest(Func<AspNetWebSocketContext,Task>, AspNetWebSocketOptions)

When implemented in a derived class, accepts an AspNetWebSocket request using the specified user function and options object.

(Inherited from HttpContextBase)
AddError(Exception)

Adds an exception to the exception collection for the current HTTP request.

AddOnRequestCompleted(Action<HttpContextBase>)

Raises a virtual event that occurs when the HTTP part of the request is ending.

AddOnRequestCompleted(Action<HttpContextBase>)

When implemented in a derived class, raises a virtual event that occurs when the HTTP part of the request is ending.

(Inherited from HttpContextBase)
ClearError()

Clears all errors for the current HTTP request.

DisposeOnPipelineCompleted(IDisposable)

Enables an object's Dispose() method to be called when the AspNetWebSocket connection part of this request is completed.

DisposeOnPipelineCompleted(IDisposable)

When implemented in a derived class, enables an object's Dispose() method to be called when the AspNetWebSocket connection part of this request is completed.

(Inherited from HttpContextBase)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetGlobalResourceObject(String, String)

Gets an application-level resource object based on the specified ClassKey and ResourceKey properties.

GetGlobalResourceObject(String, String, CultureInfo)

Gets an application-level resource object based on the specified ClassKey and ResourceKey properties, and on the CultureInfo object.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLocalResourceObject(String, String)

Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.

GetLocalResourceObject(String, String, CultureInfo)

Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object.

GetSection(String)

Gets the specified configuration section of the current application's default configuration.

GetService(Type)

Returns an object for the current service type.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemapHandler(IHttpHandler)

Enables you to specify a handler for the request.

RemapHandler(IHttpHandler)

When overridden in a derived class, specifies a handler for the request.

(Inherited from HttpContextBase)
RewritePath(String)

Rewrites the URL by using the specified path.

RewritePath(String, Boolean)

Rewrites the URL by using the specified path and a value that specifies whether the virtual path for server resources is modified.

RewritePath(String, String, String)

Rewrites the URL by using the specified path, path information, and query string information.

RewritePath(String, String, String, Boolean)

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.

SetSessionStateBehavior(SessionStateBehavior)

Sets the type of session state behavior that is required in order to support an HTTP request.

SetSessionStateBehavior(SessionStateBehavior)

When overridden in a derived class, sets the type of session state behavior that is required to support an HTTP request.

(Inherited from HttpContextBase)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to