Export (0) Print
Expand All

HttpResponseBase Class

Represents the base class for classes that provides HTTP-response information from an ASP.NET operation.

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

'Declaration
Public MustInherit Class HttpResponseBase

The HttpResponseBase type exposes the following members.

  NameDescription
Protected methodHttpResponseBaseInitializes a new instance of the HttpResponseBase class.
Top

  NameDescription
Public propertyBufferGets or sets a value that indicates whether to buffer output and send it after the complete response has finished processing.
Public propertyBufferOutputGets or sets a value that indicates whether to buffer output and send it after the complete page has finished processing.
Public propertyCacheGets the caching policy (such as expiration time, privacy settings, and vary clauses) of the current Web page.
Public propertyCacheControlGets or sets the Cache-Control HTTP header that matches one of the HttpCacheability enumeration values.
Public propertyCharsetGets or sets the HTTP character set of the current response.
Public propertyClientDisconnectedTokenGets a CancellationToken object that is tripped when the client disconnects.
Public propertyContentEncodingGets or sets the content encoding of the current response.
Public propertyContentTypeGets or sets the HTTP MIME type of the current response.
Public propertyCookiesGets the response cookie collection.
Public propertyExpiresGets or sets the number of minutes before a page that is cached on the client or proxy expires. If the user returns to the same page before it expires, the cached version is displayed. Expires is provided for compatibility with earlier versions of Active Server Pages (ASP).
Public propertyExpiresAbsoluteGets or sets the absolute date and time at which cached information expires in the cache. ExpiresAbsolute is provided for compatibility with earlier versions of Active Server Pages (ASP).
Public propertyFilterGets or sets a filter object that is used to modify the HTTP entity body before transmission.
Public propertyHeaderEncodingGets or sets the encoding for the header of the current response.
Public propertyHeadersGets the collection of response headers.
Public propertyHeadersWritten[Supported in the .NET Framework 4.5.2 and later versions]Gets a value indicating whether the response headers have been written.
Public propertyIsClientConnectedGets a value that indicates whether the client is connected to the server.
Public propertyIsRequestBeingRedirectedGets a value that indicates whether the client is being redirected to a new location.
Public propertyOutputGets the object that enables text output to the HTTP response stream.
Public propertyOutputStreamGets the object that enables binary output to the outgoing HTTP content body.
Public propertyRedirectLocationGets or sets the value of the HTTP Location header.
Public propertyStatusGets or sets the Status value that is returned to the client.
Public propertyStatusCodeGets or sets the HTTP status code of the output that is returned to the client.
Public propertyStatusDescriptionGets or sets the HTTP status message of the output that is returned to the client.
Public propertySubStatusCodeGets or sets a value that qualifies the status code of the response.
Public propertySupportsAsyncFlushGets a value that indicates whether the connection supports asynchronous flush operation.
Public propertySuppressContentGets or sets a value that indicates whether to send HTTP content to the client.
Public propertySuppressDefaultCacheControlHeader[Supported in the .NET Framework 4.5.2 and later versions]Gets or sets a value indicating whether to suppress the default Cache Control: private header for the current HTTP response.
Public propertySuppressFormsAuthenticationRedirectGets or sets a value that specifies whether forms authentication redirection to the login page should be suppressed.
Public propertyTrySkipIisCustomErrorsGets or sets a value that specifies whether IIS 7.0 custom errors are disabled.
Top

  NameDescription
Public methodAddCacheDependencyAdds an associates cache dependencies with the response that enable the response to be invalidated if it is cached and if the specified dependencies change.
Public methodAddCacheItemDependencies(ArrayList)Makes the validity of a cached response dependent on the specified items in the cache.
Public methodAddCacheItemDependencies(String())Makes the validity of a cached item dependent on the specified items in the cache.
Public methodAddCacheItemDependencyMakes the validity of a cached response dependent on the specified item in the cache.
Public methodAddFileDependencies(ArrayList)Adds file names to the collection of file names on which the current response is dependent.
Public methodAddFileDependencies(String())Adds an array of file names to the collection of file names on which the current response is dependent.
Public methodAddFileDependencyAdds a single file name to the collection of file names on which the current response is dependent.
Public methodAddHeaderAdds an HTTP header to the current response. This method is provided for compatibility with earlier versions of ASP.
Public methodAddOnSendingHeaders[Supported in the .NET Framework 4.5.2 and later versions]Registers a callback that the ASP.NET runtime will invoke immediately before response headers are sent for this request.
Public methodAppendCookieAdds an HTTP cookie to the HTTP response cookie collection.
Public methodAppendHeaderAdds an HTTP header to the current response.
Public methodAppendToLogAdds custom log information to the Internet Information Services (IIS) log file.
Public methodApplyAppPathModifierAdds a session ID to the virtual path if the session is using Cookieless session state, and returns the combined path.
Public methodBeginFlushSends the currently buffered response to the client.
Public methodBinaryWriteWrites a string of binary characters to the HTTP output stream.
Public methodClearClears all headers and content output from the current response.
Public methodClearContentClears all content from the current response.
Public methodClearHeadersClears all headers from the current response.
Public methodCloseCloses the socket connection to a client.
Public methodDisableKernelCacheDisables kernel caching for the current response.
Public methodDisableUserCacheDisables IIS user-mode caching for this response.
Public methodEndSends all currently buffered output to the client, stops execution of the requested process, and raises the EndRequest event.
Public methodEndFlushCompletes an asynchronous flush operation.
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 methodFlushSends all currently buffered output to the client.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodPicsAppends an HTTP PICS-Label header to the current response.
Public methodPushPromise(String)Promotes a promised object.
Public methodPushPromise(String, String, NameValueCollection)Promotes a promised object.
Public methodRedirect(String)Redirects a request to the specified URL.
Public methodRedirect(String, Boolean)Redirects a request to the specified URL and specifies whether execution of the current process should terminate.
Public methodRedirectPermanent(String)Performs a permanent redirect from the requested URL to the specified URL.
Public methodRedirectPermanent(String, Boolean)Performs a permanent redirect from the requested URL to the specified URL, and provides the option to complete the response.
Public methodRedirectToRoute(Object)Redirects the request to a new URL by using route parameter values.
Public methodRedirectToRoute(RouteValueDictionary)Redirects the request to a new URL by using route parameter values.
Public methodRedirectToRoute(String)Redirects the request to a new URL by using a route name.
Public methodRedirectToRoute(String, Object)Redirects the request to a new URL by using route parameter values and a route name.
Public methodRedirectToRoute(String, RouteValueDictionary)Redirects the request to a new URL by using route parameter values and a route name.
Public methodRedirectToRoutePermanent(Object)Performs a permanent redirection from the requested URL to a new URL by using route parameter values.
Public methodRedirectToRoutePermanent(RouteValueDictionary)Performs a permanent redirection from the requested URL to a new URL by using route parameter values.
Public methodRedirectToRoutePermanent(String)Performs a permanent redirection from the requested URL to a new URL by using a route name.
Public methodRedirectToRoutePermanent(String, Object)Performs a permanent redirection from the requested URL to a new URL by using the route parameter values and the name of the route that correspond to the new URL.
Public methodRedirectToRoutePermanent(String, RouteValueDictionary)Performs a permanent redirection from the requested URL to a new URL by using route parameter values and a route name.
Public methodRemoveOutputCacheItem(String)Removes from the cache all cached items that are associated with the specified path.
Public methodRemoveOutputCacheItem(String, String)Uses the specified output-cache provider to remove all output-cache artifacts that are associated with the specified path.
Public methodSetCookieUpdates an existing cookie in the cookie collection.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTransmitFile(String)Writes the specified file to the HTTP response output stream, without buffering it in memory.
Public methodTransmitFile(String, Int64, Int64)Writes the specified part of a file to the HTTP response output stream, without buffering it in memory.
Public methodWrite(Char)Writes a character to an HTTP response output stream.
Public methodWrite(Object)Writes the specified object to the HTTP response stream.
Public methodWrite(String)Writes the specified string to the HTTP response output stream.
Public methodWrite(Char(), Int32, Int32)Writes the specified array of characters to the HTTP response output stream.
Public methodWriteFile(String)Writes the contents of the specified file to the HTTP response output stream as a file block.
Public methodWriteFile(String, Boolean)Writes the contents of the specified file to the HTTP response output stream and specifies whether the content is written as a memory block.
Public methodWriteFile(IntPtr, Int64, Int64)Writes the specified file to the HTTP response output stream.
Public methodWriteFile(String, Int64, Int64)Writes the specified file to the HTTP response output stream.
Public methodWriteSubstitutionInserts substitution blocks into the response, which enables dynamic generation of regions for cached output responses.
Top

The HttpResponseBase class is an abstract class that contains the same members as the HttpResponse class. The HttpResponseBase class enables you to create derived classes that are like the HttpResponse 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 that have customized behavior that fulfills the scenario you are testing.

The HttpResponseWrapper class derives from the HttpResponseBase class. The HttpResponseWrapper class serves as a wrapper for the HttpResponse class. At run time, you typically use an instance of the HttpResponseWrapper class to call members of the HttpResponse object.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft