HttpResponseBase Class

Definition

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

public abstract class HttpResponseBase
Inheritance
HttpResponseBase
Derived

Remarks

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.

Constructors

HttpResponseBase()

Initializes a new instance of the HttpResponseBase class.

Properties

Buffer

Gets or sets a value that indicates whether to buffer output and send it after the complete response has finished processing.

BufferOutput

Gets or sets a value that indicates whether to buffer output and send it after the complete page has finished processing.

Cache

Gets the caching policy (such as expiration time, privacy settings, and vary clauses) of the current Web page.

CacheControl

Gets or sets the Cache-Control HTTP header that matches one of the HttpCacheability enumeration values.

Charset

Gets or sets the HTTP character set of the current response.

ClientDisconnectedToken

Gets a CancellationToken object that is tripped when the client disconnects.

ContentEncoding

Gets or sets the content encoding of the current response.

ContentType

Gets or sets the HTTP MIME type of the current response.

Cookies

Gets the response cookie collection.

Expires

Gets 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).

ExpiresAbsolute

Gets 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).

Filter

Gets or sets a filter object that is used to modify the HTTP entity body before transmission.

HeaderEncoding

Gets or sets the encoding for the header of the current response.

Headers

Gets the collection of response headers.

HeadersWritten

Gets a value indicating whether the response headers have been written.

IsClientConnected

Gets a value that indicates whether the client is connected to the server.

IsRequestBeingRedirected

Gets a value that indicates whether the client is being redirected to a new location.

Output

Gets the object that enables text output to the HTTP response stream.

OutputStream

Gets the object that enables binary output to the outgoing HTTP content body.

RedirectLocation

Gets or sets the value of the HTTP Location header.

Status

Gets or sets the Status value that is returned to the client.

StatusCode

Gets or sets the HTTP status code of the output that is returned to the client.

StatusDescription

Gets or sets the HTTP status message of the output that is returned to the client.

SubStatusCode

Gets or sets a value that qualifies the status code of the response.

SupportsAsyncFlush

Gets a value that indicates whether the connection supports asynchronous flush operation.

SuppressContent

Gets or sets a value that indicates whether only the HTTP headers will be sent to the client.

SuppressDefaultCacheControlHeader

Gets or sets a value indicating whether to suppress the default Cache Control: private header for the current HTTP response.

SuppressFormsAuthenticationRedirect

Gets or sets a value that specifies whether forms authentication redirection to the login page should be suppressed.

TrySkipIisCustomErrors

Gets or sets a value that specifies whether IIS 7.0 custom errors are disabled.

Methods

AddCacheDependency(CacheDependency[])

Adds an associates cache dependencies with the response that enable the response to be invalidated if it is cached and if the specified dependencies change.

AddCacheItemDependencies(ArrayList)

Makes the validity of a cached response dependent on the specified items in the cache.

AddCacheItemDependencies(String[])

Makes the validity of a cached item dependent on the specified items in the cache.

AddCacheItemDependency(String)

Makes the validity of a cached response dependent on the specified item in the cache.

AddFileDependencies(ArrayList)

Adds file names to the collection of file names on which the current response is dependent.

AddFileDependencies(String[])

Adds an array of file names to the collection of file names on which the current response is dependent.

AddFileDependency(String)

Adds a single file name to the collection of file names on which the current response is dependent.

AddHeader(String, String)

Adds an HTTP header to the current response. This method is provided for compatibility with earlier versions of ASP.

AddOnSendingHeaders(Action<HttpContextBase>)

Registers a callback that the ASP.NET runtime will invoke immediately before response headers are sent for this request.

AppendCookie(HttpCookie)

Adds an HTTP cookie to the HTTP response cookie collection.

AppendHeader(String, String)

Adds an HTTP header to the current response.

AppendToLog(String)

Adds custom log information to the Internet Information Services (IIS) log file.

ApplyAppPathModifier(String)

Adds a session ID to the virtual path if the session is using Cookieless session state, and returns the combined path.

BeginFlush(AsyncCallback, Object)

Sends the currently buffered response to the client.

BinaryWrite(Byte[])

Writes a string of binary characters to the HTTP output stream.

Clear()

Clears all headers and content output from the current response.

ClearContent()

Clears all content from the current response.

ClearHeaders()

Clears all headers from the current response.

Close()

Closes the socket connection to a client.

DisableKernelCache()

Disables kernel caching for the current response.

DisableUserCache()

Disables IIS user-mode caching for this response.

End()

Sends all currently buffered output to the client, stops execution of the requested process, and raises the EndRequest event.

EndFlush(IAsyncResult)

Completes an asynchronous flush operation.

Equals(Object)

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

(Inherited from Object)
Flush()

Sends all currently buffered output to the client.

FlushAsync()

Asynchronously sends all currently buffered output to the client.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Pics(String)

Appends an HTTP PICS-Label header to the current response.

PushPromise(String, String, NameValueCollection)

Supports applications sending push promises to HTTP 2.0 clients. For more information, see HTTP/2 Specification Section 8.2: Server Push.

PushPromise(String)

Supports applications sending push promises to HTTP 2.0 clients. For more information, see HTTP/2 Specification Section 8.2: Server Push.

Redirect(String, Boolean)

Redirects a request to the specified URL and specifies whether execution of the current process should terminate.

Redirect(String)

Redirects a request to the specified URL.

RedirectPermanent(String, Boolean)

Performs a permanent redirect from the requested URL to the specified URL, and provides the option to complete the response.

RedirectPermanent(String)

Performs a permanent redirect from the requested URL to the specified URL.

RedirectToRoute(Object)

Redirects the request to a new URL by using route parameter values.

RedirectToRoute(RouteValueDictionary)

Redirects the request to a new URL by using route parameter values.

RedirectToRoute(String, Object)

Redirects the request to a new URL by using route parameter values and a route name.

RedirectToRoute(String, RouteValueDictionary)

Redirects the request to a new URL by using route parameter values and a route name.

RedirectToRoute(String)

Redirects the request to a new URL by using a route name.

RedirectToRoutePermanent(Object)

Performs a permanent redirection from the requested URL to a new URL by using route parameter values.

RedirectToRoutePermanent(RouteValueDictionary)

Performs a permanent redirection from the requested URL to a new URL by using route parameter values.

RedirectToRoutePermanent(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.

RedirectToRoutePermanent(String, RouteValueDictionary)

Performs a permanent redirection from the requested URL to a new URL by using route parameter values and a route name.

RedirectToRoutePermanent(String)

Performs a permanent redirection from the requested URL to a new URL by using a route name.

RemoveOutputCacheItem(String, String)

Uses the specified output-cache provider to remove all output-cache artifacts that are associated with the specified path.

RemoveOutputCacheItem(String)

Removes from the cache all cached items that are associated with the specified path.

SetCookie(HttpCookie)

Updates an existing cookie in the cookie collection.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TransmitFile(String, Int64, Int64)

Writes the specified part of a file to the HTTP response output stream, without buffering it in memory.

TransmitFile(String)

Writes the specified file to the HTTP response output stream, without buffering it in memory.

Write(Char)

Writes a character to an HTTP response output stream.

Write(Char[], Int32, Int32)

Writes the specified array of characters to the HTTP response output stream.

Write(Object)

Writes the specified object to the HTTP response stream.

Write(String)

Writes the specified string to the HTTP response output stream.

WriteFile(IntPtr, Int64, Int64)

Writes the specified file to the HTTP response output stream.

WriteFile(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.

WriteFile(String, Int64, Int64)

Writes the specified file to the HTTP response output stream.

WriteFile(String)

Writes the contents of the specified file to the HTTP response output stream as a file block.

WriteSubstitution(HttpResponseSubstitutionCallback)

Inserts substitution blocks into the response, which enables dynamic generation of regions for cached output responses.

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1