Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HttpContextWrapper Class

Encapsulates the HTTP intrinsic object that contains 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 class HttpContextWrapper : HttpContextBase

The HttpContextWrapper type exposes the following members.

  NameDescription
Public methodHttpContextWrapperInitializes a new instance of the HttpContextWrapper class by using the specified context object.
Top
  NameDescription
Public propertyAllErrorsGets an array of errors (if any) that accumulated when an HTTP request was being processed. (Overrides HttpContextBase.AllErrors.)
Public propertyApplicationGets the HttpApplicationState object for the current HTTP request. (Overrides HttpContextBase.Application.)
Public propertyApplicationInstanceGets or sets the HttpApplication object for the current HTTP request. (Overrides HttpContextBase.ApplicationInstance.)
Public propertyCacheGets the Cache object for the current application domain. (Overrides HttpContextBase.Cache.)
Public propertyCurrentHandlerGets the IHttpHandler object that represents the handler that is currently executing. (Overrides HttpContextBase.CurrentHandler.)
Public propertyCurrentNotificationGets a RequestNotification value that indicates the current HttpApplication event that is processing. (Overrides HttpContextBase.CurrentNotification.)
Public propertyErrorGets the first error (if any) that accumulated when an HTTP request was being processed. (Overrides HttpContextBase.Error.)
Public propertyHandlerGets or sets the IHttpHandler object that is responsible for processing the HTTP request. (Overrides HttpContextBase.Handler.)
Public propertyIsCustomErrorEnabledGets a value that indicates whether custom errors are enabled for the current HTTP request. (Overrides HttpContextBase.IsCustomErrorEnabled.)
Public propertyIsDebuggingEnabledGets a value that indicates whether the current HTTP request is in debug mode. (Overrides HttpContextBase.IsDebuggingEnabled.)
Public propertyIsPostNotificationGets a value that indicates whether an HttpApplication event has finished processing. (Overrides HttpContextBase.IsPostNotification.)
Public propertyItemsGets a key/value collection that can be used to organize and share data between a module and a handler during an HTTP request. (Overrides HttpContextBase.Items.)
Public propertyPreviousHandlerGets the IHttpHandler object for the parent handler. (Overrides HttpContextBase.PreviousHandler.)
Public propertyProfileGets the ProfileBase object for the current user profile. (Overrides HttpContextBase.Profile.)
Public propertyRequestGets the HttpRequestBase object for the current HTTP request. (Overrides HttpContextBase.Request.)
Public propertyResponseGets the HttpResponseBase object for the current HTTP response. (Overrides HttpContextBase.Response.)
Public propertyServerGets the HttpServerUtilityBase object that provides methods that are used when Web requests are being processed. (Overrides HttpContextBase.Server.)
Public propertySessionGets the HttpSessionStateBase object for the current HTTP request. (Overrides HttpContextBase.Session.)
Public propertySkipAuthorizationGets or sets a value that specifies whether the UrlAuthorizationModule object should skip the authorization check for the current request. (Overrides HttpContextBase.SkipAuthorization.)
Public propertyTimestampGets the initial timestamp of the current HTTP request. (Overrides HttpContextBase.Timestamp.)
Public propertyTraceGets the TraceContext object for the current HTTP response. (Overrides HttpContextBase.Trace.)
Public propertyUserGets or sets security information for the current HTTP request. (Overrides HttpContextBase.User.)
Top
  NameDescription
Public methodAddErrorAdds an exception to the exception collection for the current HTTP request. (Overrides HttpContextBase.AddError(Exception).)
Public methodClearErrorClears all errors for the current HTTP request. (Overrides HttpContextBase.ClearError().)
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)Gets an application-level resource object based on the specified ClassKey and ResourceKey properties. (Overrides HttpContextBase.GetGlobalResourceObject(String, String).)
Public methodGetGlobalResourceObject(String, String, CultureInfo)Gets an application-level resource object based on the specified ClassKey and ResourceKey properties, and on the CultureInfo object. (Overrides HttpContextBase.GetGlobalResourceObject(String, String, CultureInfo).)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLocalResourceObject(String, String)Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties. (Overrides HttpContextBase.GetLocalResourceObject(String, String).)
Public methodGetLocalResourceObject(String, String, CultureInfo)Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object. (Overrides HttpContextBase.GetLocalResourceObject(String, String, CultureInfo).)
Public methodGetSectionGets the specified configuration section of the current application's default configuration. (Overrides HttpContextBase.GetSection(String).)
Public methodGetServiceReturns an object for the current service type. (Overrides HttpContextBase.GetService(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 methodRemapHandlerEnables you to specify a handler for the request. (Overrides HttpContextBase.RemapHandler(IHttpHandler).)
Public methodRewritePath(String)Rewrites the URL by using the specified path. (Overrides HttpContextBase.RewritePath(String).)
Public methodRewritePath(String, Boolean)Rewrites the URL by using the specified path and a value that specifies whether the virtual path for server resources is modified. (Overrides HttpContextBase.RewritePath(String, Boolean).)
Public methodRewritePath(String, String, String)Rewrites the URL by using the specified path, path information, and query string information. (Overrides HttpContextBase.RewritePath(String, String, String).)
Public methodRewritePath(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. (Overrides HttpContextBase.RewritePath(String, String, String, Boolean).)
Public methodSetSessionStateBehaviorSets the type of session state behavior that is required in order to support an HTTP request. (Overrides HttpContextBase.SetSessionStateBehavior(SessionStateBehavior).)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

.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)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.