HttpResponse HttpResponse HttpResponse HttpResponse Class

Definition

Represents the outgoing side of an individual HTTP request.

public ref class HttpResponse abstract
public abstract class HttpResponse
type HttpResponse = class
Public MustInherit Class HttpResponse
Inheritance
HttpResponseHttpResponseHttpResponseHttpResponse

Constructors

HttpResponse() HttpResponse() HttpResponse() HttpResponse()

Properties

Body Body Body Body

Gets or sets the response body Stream.

BodyWriter BodyWriter BodyWriter BodyWriter

Gets the response body PipeWriter

ContentLength ContentLength ContentLength ContentLength

Gets or sets the value for the Content-Length response header.

ContentType ContentType ContentType ContentType

Gets or sets the value for the Content-Type response header.

Cookies Cookies Cookies Cookies

Gets an object that can be used to manage cookies for this response.

HasStarted HasStarted HasStarted HasStarted

Gets a value indicating whether response headers have been sent to the client.

Headers Headers Headers Headers

Gets the response headers.

HttpContext HttpContext HttpContext HttpContext

Gets the HttpContext for this response.

StatusCode StatusCode StatusCode StatusCode

Gets or sets the HTTP response code.

Methods

CompleteAsync() CompleteAsync() CompleteAsync() CompleteAsync()

Flush any remaining response headers, data, or trailers. This may throw if the response is in an invalid state such as a Content-Length mismatch.

OnCompleted(Func<Task>) OnCompleted(Func<Task>) OnCompleted(Func<Task>) OnCompleted(Func<Task>)

Adds a delegate to be invoked after the response has finished being sent to the client.

OnCompleted(Func<Object,Task>, Object) OnCompleted(Func<Object,Task>, Object) OnCompleted(Func<Object,Task>, Object) OnCompleted(Func<Object,Task>, Object)

Adds a delegate to be invoked after the response has finished being sent to the client.

OnStarting(Func<Task>) OnStarting(Func<Task>) OnStarting(Func<Task>) OnStarting(Func<Task>)

Adds a delegate to be invoked just before response headers will be sent to the client.

OnStarting(Func<Object,Task>, Object) OnStarting(Func<Object,Task>, Object) OnStarting(Func<Object,Task>, Object) OnStarting(Func<Object,Task>, Object)

Adds a delegate to be invoked just before response headers will be sent to the client.

Redirect(String) Redirect(String) Redirect(String) Redirect(String)

Returns a temporary redirect response (HTTP 302) to the client.

Redirect(String, Boolean) Redirect(String, Boolean) Redirect(String, Boolean) Redirect(String, Boolean)

Returns a redirect response (HTTP 301 or HTTP 302) to the client.

RegisterForDispose(IDisposable) RegisterForDispose(IDisposable) RegisterForDispose(IDisposable) RegisterForDispose(IDisposable)

Registers an object for disposal by the host once the request has finished processing.

RegisterForDisposeAsync(IAsyncDisposable) RegisterForDisposeAsync(IAsyncDisposable) RegisterForDisposeAsync(IAsyncDisposable) RegisterForDisposeAsync(IAsyncDisposable)

Registers an object for asynchronous disposal by the host once the request has finished processing.

StartAsync(CancellationToken) StartAsync(CancellationToken) StartAsync(CancellationToken) StartAsync(CancellationToken)

Starts the response by calling OnStarting() and making headers unmodifiable.

Extension Methods

GetTypedHeaders(HttpResponse) GetTypedHeaders(HttpResponse) GetTypedHeaders(HttpResponse) GetTypedHeaders(HttpResponse)
WriteAsync(HttpResponse, String, Encoding, CancellationToken) WriteAsync(HttpResponse, String, Encoding, CancellationToken) WriteAsync(HttpResponse, String, Encoding, CancellationToken) WriteAsync(HttpResponse, String, Encoding, CancellationToken)

Writes the given text to the response body using the given encoding.

WriteAsync(HttpResponse, String, CancellationToken) WriteAsync(HttpResponse, String, CancellationToken) WriteAsync(HttpResponse, String, CancellationToken) WriteAsync(HttpResponse, String, CancellationToken)

Writes the given text to the response body. UTF-8 encoding will be used.

Clear(HttpResponse) Clear(HttpResponse) Clear(HttpResponse) Clear(HttpResponse)
Redirect(HttpResponse, String, Boolean, Boolean) Redirect(HttpResponse, String, Boolean, Boolean) Redirect(HttpResponse, String, Boolean, Boolean) Redirect(HttpResponse, String, Boolean, Boolean)

Returns a redirect response (HTTP 301, HTTP 302, HTTP 307 or HTTP 308) to the client.

AppendTrailer(HttpResponse, String, StringValues) AppendTrailer(HttpResponse, String, StringValues) AppendTrailer(HttpResponse, String, StringValues) AppendTrailer(HttpResponse, String, StringValues)

Adds the given trailer header to the trailers collection to be sent at the end of the response body. Check SupportsTrailers(HttpResponse) or an InvalidOperationException may be thrown.

DeclareTrailer(HttpResponse, String) DeclareTrailer(HttpResponse, String) DeclareTrailer(HttpResponse, String) DeclareTrailer(HttpResponse, String)

Adds the given trailer name to the 'Trailer' response header. This must happen before the response headers are sent.

SupportsTrailers(HttpResponse) SupportsTrailers(HttpResponse) SupportsTrailers(HttpResponse) SupportsTrailers(HttpResponse)

Indicates if the server supports sending trailer headers for this response.

SendFileAsync(HttpResponse, IFileInfo, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, Int64, Nullable<Int64>, CancellationToken)

Sends the given file using the SendFile extension.

SendFileAsync(HttpResponse, IFileInfo, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, CancellationToken) SendFileAsync(HttpResponse, IFileInfo, CancellationToken)

Sends the given file using the SendFile extension.

SendFileAsync(HttpResponse, String, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, String, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, String, Int64, Nullable<Int64>, CancellationToken) SendFileAsync(HttpResponse, String, Int64, Nullable<Int64>, CancellationToken)

Sends the given file using the SendFile extension.

SendFileAsync(HttpResponse, String, CancellationToken) SendFileAsync(HttpResponse, String, CancellationToken) SendFileAsync(HttpResponse, String, CancellationToken) SendFileAsync(HttpResponse, String, CancellationToken)

Sends the given file using the SendFile extension.

Applies to