HttpResponse HttpResponse HttpResponse Class

Definition

Represents the outgoing side of an individual HTTP request.

public abstract class HttpResponse
type HttpResponse = class
Public MustInherit Class HttpResponse
Inheritance
HttpResponseHttpResponseHttpResponse
Derived

Constructors

HttpResponse() HttpResponse() HttpResponse()

Properties

Body Body Body

Gets or sets the response body Stream.

ContentLength ContentLength ContentLength

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

ContentType ContentType ContentType

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

Cookies Cookies Cookies

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

HasStarted HasStarted HasStarted

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

Headers Headers Headers

Gets the response headers.

HttpContext HttpContext HttpContext

Gets the HttpContext for this response.

StatusCode StatusCode StatusCode

Gets or sets the HTTP response code.

Methods

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)

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

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)

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

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)

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

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

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

Extension Methods

GetTypedHeaders(HttpResponse) GetTypedHeaders(HttpResponse) GetTypedHeaders(HttpResponse)
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)

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

Clear(HttpResponse) Clear(HttpResponse) Clear(HttpResponse)
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)

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)

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)

Sends the given file using the SendFile extension.

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)

Sends the given file using the SendFile extension.

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

Sends the given file using the SendFile extension.

Applies to