Condividi tramite


TypedResults Classe

Definizione

Factory tipizzata per i tipi IResult in Microsoft.AspNetCore.Http.HttpResults.

public static class TypedResults
type TypedResults = class
Public Class TypedResults
Ereditarietà
TypedResults

Proprietà

Empty

Produce una risposta di risultato vuota, che quando viene eseguita non eseguirà alcuna operazione.

Extensions

Fornisce un contenitore per le librerie esterne per estendere il TypedResults predefinito impostato con i propri esempi.

Metodi

Accepted(String)

Produce una risposta Status202Accepted.

Accepted(Uri)

Produce una risposta Status202Accepted.

Accepted<TValue>(String, TValue)

Produce una risposta Status202Accepted.

Accepted<TValue>(Uri, TValue)

Produce una risposta Status202Accepted.

AcceptedAtRoute(String, Object)

Produce una risposta Status202Accepted.

AcceptedAtRoute(String, RouteValueDictionary)

Produce una risposta Status202Accepted.

AcceptedAtRoute<TValue>(TValue, String, Object)

Produce una risposta Status202Accepted.

AcceptedAtRoute<TValue>(TValue, String, RouteValueDictionary)

Produce una risposta Status202Accepted.

BadRequest()

Produce una risposta Status400BadRequest.

BadRequest<TValue>(TValue)

Produce una risposta Status400BadRequest.

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

Scrive il contenuto della matrice di byte nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Questa API è un alias per File(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

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

Scrive il contenuto della matrice di byte nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Challenge(AuthenticationProperties, IList<String>)

Crea un ChallengeHttpResult che all'esecuzione richiama ChallengeAsync(HttpContext, String, AuthenticationProperties).

Il comportamento di questo metodo dipende dal IAuthenticationService in uso. Status401Unauthorized e Status403Forbidden sono tra i risultati probabili dello stato.

Conflict()

Produce una risposta Status409Conflict.

Conflict<TValue>(TValue)

Produce una risposta Status409Conflict.

Content(String, MediaTypeHeaderValue)

Scrive la stringa content nella risposta HTTP.

Content(String, String, Encoding)

Scrive la stringa content nella risposta HTTP.

Equivale a Text(String, String, Encoding).

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

Scrive la stringa content nella risposta HTTP.

Equivale a Text(String, String, Encoding, Nullable<Int32>).

Created()

Produce una risposta Status201Created.

Created(String)

Produce una risposta Status201Created.

Created(Uri)

Produce una risposta Status201Created.

Created<TValue>(String, TValue)

Produce una risposta Status201Created.

Created<TValue>(Uri, TValue)

Produce una risposta Status201Created.

CreatedAtRoute(String, Object)

Produce una risposta Status201Created.

CreatedAtRoute(String, RouteValueDictionary)

Produce una risposta Status201Created.

CreatedAtRoute<TValue>(TValue, String, Object)

Produce una risposta Status201Created.

CreatedAtRoute<TValue>(TValue, String, RouteValueDictionary)

Produce una risposta Status201Created.

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

Scrive il contenuto della matrice di byte nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Questa API è un alias per Bytes(Byte[], String, String, Boolean, Nullable<DateTimeOffset>, EntityTagHeaderValue).

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

Scrive il Stream specificato nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Questa API è un alias per Stream(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean).

Forbid(AuthenticationProperties, IList<String>)

Crea un ForbidHttpResult che all'esecuzione richiama ForbidAsync(HttpContext, String, AuthenticationProperties).

Per impostazione predefinita, l'esecuzione di questo risultato restituisce un Status403Forbidden. Alcuni schemi di autenticazione, ad esempio i cookie, convertiranno Status403Forbidden in un reindirizzamento per visualizzare una pagina di accesso.

InternalServerError()

Produce una risposta Status500InternalServerError.

InternalServerError<TValue>(TValue)

Produce una risposta Status500InternalServerError.

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

Crea un JsonHttpResult<TValue> che serializza l'oggetto data specificato in JSON.

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

Crea un JsonHttpResult<TValue> che serializza l'oggetto data specificato in JSON.

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

Crea un JsonHttpResult<TValue> che serializza l'oggetto data specificato in JSON.

LocalRedirect(String, Boolean, Boolean)

Reindirizza al localUrlspecificato.

NoContent()

Produce una risposta Status204NoContent.

NotFound()

Produce una risposta Status404NotFound.

NotFound<TValue>(TValue)

Produce una risposta Status404NotFound.

Ok()

Produce una risposta Status200OK.

Ok<TValue>(TValue)

Produce una risposta Status200OK.

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

Scrive il file nel path specificato nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Problem(ProblemDetails)

Produce una risposta ProblemDetails.

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

Produce una risposta ProblemDetails.

Redirect(String, Boolean, Boolean)

Reindirizza al urlspecificato.

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

Reindirizza alla route specificata.

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

Reindirizza alla route specificata.

SignIn(ClaimsPrincipal, AuthenticationProperties, String)

Crea un SignInHttpResult che all'esecuzione richiama SignInAsync(HttpContext, String, ClaimsPrincipal, AuthenticationProperties).

SignOut(AuthenticationProperties, IList<String>)

Crea un SignOutHttpResult che all'esecuzione richiama SignOutAsync(HttpContext, String, AuthenticationProperties).

StatusCode(Int32)

Crea un oggetto StatusCodeHttpResult specificando un statusCode.

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

Consente di scrivere direttamente nel corpo della risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

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

Scrive il contenuto del PipeReader specificato nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

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

Scrive il Stream specificato nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Questa API è un alias per File(Stream, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean).

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

Scrive il contenuto di testo UTF8 utf8Content nella risposta HTTP.

Text(String, String, Encoding)

Scrive la stringa content nella risposta HTTP.

Si tratta di un alias per Content(String, String, Encoding).

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

Scrive la stringa content nella risposta HTTP.

Si tratta di un alias per Content(String, String, Encoding, Nullable<Int32>).

Unauthorized()

Produce una risposta Status401Unauthorized.

UnprocessableEntity()

Produce una risposta Status422UnprocessableEntity.

UnprocessableEntity<TValue>(TValue)

Produce una risposta Status422UnprocessableEntity.

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

Produce una risposta Status400BadRequest con un valore HttpValidationProblemDetails.

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

Scrive il file nel path specificato nella risposta.

Supporta le richieste di intervallo (Status206PartialContent o Status416RangeNotSatisfiable se l'intervallo non è soddisfacente).

Si applica a