Results Class

Definition

A factory for IResult.

public static class Results
type Results = class
Public Class Results
Inheritance
Results

Properties

Empty

Produces an empty result response, that when executed will do nothing.

Extensions

Provides a container for external libraries to extend the default Results set with their own samples.

Methods

Accepted(String, Object)

Produces a Status202Accepted response.

Accepted<TValue>(String, TValue)

Produces a Status202Accepted response.

AcceptedAtRoute(String, Object, Object)

Produces a Status202Accepted response.

AcceptedAtRoute(String, RouteValueDictionary, Object)

Produces a Status202Accepted response.

AcceptedAtRoute<TValue>(String, Object, TValue)

Produces a Status202Accepted response.

AcceptedAtRoute<TValue>(String, RouteValueDictionary, TValue)

Produces a Status202Accepted response.

BadRequest(Object)

Produces a Status400BadRequest response.

BadRequest<TValue>(TValue)

Produces a Status400BadRequest response.

Bytes(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for File(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

Bytes(ReadOnlyMemory<Byte>, String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

Challenge(AuthenticationProperties, IList<String>)

Creates an IResult that on execution invokes ChallengeAsync(HttpContext, String, AuthenticationProperties).

The behavior of this method depends on the IAuthenticationService in use. Status401Unauthorized and Status403Forbidden are among likely status results.

Conflict(Object)

Produces a Status409Conflict response.

Conflict<TValue>(TValue)

Produces a Status409Conflict response.

Content(String, MediaTypeHeaderValue)

Writes the content string to the HTTP response.

Content(String, String, Encoding, Nullable<Int32>)

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding, Nullable<Int32>).

Content(String, String, Encoding)

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding).

Created()

Produces a Status201Created response.

Created(String, Object)

Produces a Status201Created response.

Created(Uri, Object)

Produces a Status201Created response.

Created<TValue>(String, TValue)

Produces a Status201Created response.

Created<TValue>(Uri, TValue)

Produces a Status201Created response.

CreatedAtRoute(String, Object, Object)

Produces a Status201Created response.

CreatedAtRoute(String, RouteValueDictionary, Object)

Produces a Status201Created response.

CreatedAtRoute<TValue>(String, Object, TValue)

Produces a Status201Created response.

CreatedAtRoute<TValue>(String, RouteValueDictionary, TValue)

Produces a Status201Created response.

File(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Writes the byte-array content to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for Bytes(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

File(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Writes the specified Stream to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for Stream(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean).

File(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Writes the file at the specified path to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

Forbid(AuthenticationProperties, IList<String>)

Creates a IResult that on execution invokes ForbidAsync(HttpContext, String, AuthenticationProperties).

By default, executing this result returns a Status403Forbidden. Some authentication schemes, such as cookies, will convert Status403Forbidden to a redirect to show a login page.

InternalServerError()

Produces a Status500InternalServerError response.

InternalServerError<TValue>(TValue)

Produces a Status500InternalServerError response.

Json(Object, JsonSerializerOptions, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

Json(Object, JsonTypeInfo, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

Json(Object, Type, JsonSerializerContext, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

Json<TValue>(TValue, JsonSerializerContext, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

Json<TValue>(TValue, JsonSerializerOptions, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

Json<TValue>(TValue, JsonTypeInfo<TValue>, String, Nullable<Int32>)

Creates a IResult that serializes the specified data object to JSON.

LocalRedirect(String, Boolean, Boolean)

Redirects to the specified localUrl.

NoContent()

Produces a Status204NoContent response.

NotFound(Object)

Produces a Status404NotFound response.

NotFound<TValue>(TValue)

Produces a Status404NotFound response.

Ok(Object)

Produces a Status200OK response.

Ok<TValue>(TValue)

Produces a Status200OK response.

Problem(ProblemDetails)

Produces a ProblemDetails response.

Problem(String, String, Nullable<Int32>, String, String, IDictionary<String,Object>)

Produces a ProblemDetails response.

Problem(String, String, Nullable<Int32>, String, String, IEnumerable<KeyValuePair<String,Object>>)

Produces a ProblemDetails response.

Redirect(String, Boolean, Boolean)

Redirects to the specified url.

RedirectToRoute(String, Object, Boolean, Boolean, String)

Redirects to the specified route.

RedirectToRoute(String, RouteValueDictionary, Boolean, Boolean, String)

Redirects to the specified route.

SignIn(ClaimsPrincipal, AuthenticationProperties, String)

Creates an IResult that on execution invokes SignInAsync(HttpContext, String, ClaimsPrincipal, AuthenticationProperties).

SignOut(AuthenticationProperties, IList<String>)

Creates an IResult that on execution invokes SignOutAsync(HttpContext, String, AuthenticationProperties).

StatusCode(Int32)

Creates an IResult object by specifying a statusCode.

Stream(Func<Stream,Task>, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Allows writing directly to the response body.

Stream(PipeReader, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Writes the contents of specified PipeReader to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

Stream(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Writes the specified Stream to the response.

This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).

This API is an alias for File(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean).

Text(ReadOnlySpan<Byte>, String, Nullable<Int32>)

Writes the utf8Content UTF-8 encoded text to the HTTP response.

Text(String, String, Encoding, Nullable<Int32>)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding, Nullable<Int32>).

Text(String, String, Encoding)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding).

Unauthorized()

Produces a Status401Unauthorized response.

UnprocessableEntity(Object)

Produces a Status422UnprocessableEntity response.

UnprocessableEntity<TValue>(TValue)

Produces a Status422UnprocessableEntity response.

ValidationProblem(IDictionary<String,String[]>, String, String, Nullable<Int32>, String, String, IDictionary<String,Object>)

Produces a Status400BadRequest response with a HttpValidationProblemDetails value.

ValidationProblem(IEnumerable<KeyValuePair<String,String[]>>, String, String, Nullable<Int32>, String, String, IEnumerable<KeyValuePair<String, Object>>)

Produces a Status400BadRequest response with a HttpValidationProblemDetails value.

Applies to