Delen via


Microsoft.AspNetCore.Mvc Namespace

Provides types required to build an MVC app.

Classes

AcceptedAtActionResult

An ActionResult that returns a Accepted (202) response with a Location header.

AcceptedAtRouteResult

An ActionResult that returns a Accepted (202) response with a Location header.

AcceptedResult

An ActionResult that returns an Accepted (202) response with a Location header.

AcceptVerbsAttribute

Specifies what HTTP methods an action supports.

ActionContext

Context object for execution of action which has been selected as part of an HTTP request.

ActionContextAttribute

Specifies that a controller property should be set with the current ActionContext when creating the controller. The property must have a public set method.

ActionNameAttribute

Specifies the name of an action.

ActionResult

A default implementation of IActionResult.

ActionResult<TValue>

A type that wraps either an TValue instance or an ActionResult.

AntiforgeryValidationFailedResult

A BadRequestResult used for antiforgery validation failures. Use IAntiforgeryValidationFailedResult to match for validation failures inside MVC result filters.

ApiBehaviorOptions

Options used to configure behavior for types annotated with ApiControllerAttribute.

ApiControllerAttribute

Indicates that a type and all derived types are used to serve HTTP API responses.

Controllers decorated with this attribute are configured with features and behavior targeted at improving the developer experience for building APIs.

When decorated on an assembly, all controllers in the assembly will be treated as controllers with API behavior. For more information, see ApiController attribute.

ApiConventionMethodAttribute

API conventions to be applied to a controller action.

API conventions are used to influence the output of ApiExplorer. ApiConventionMethodAttribute can be used to specify an exact convention method that applies to an action. ApiConventionTypeAttribute for details about applying conventions at the assembly or controller level.

ApiConventionTypeAttribute

API conventions to be applied to an assembly containing MVC controllers or a single controller.

API conventions are used to influence the output of ApiExplorer. Conventions must be static types. Methods in a convention are matched to an action method using rules specified by ApiConventionNameMatchAttribute that may be applied to a method name or its parameters and ApiConventionTypeMatchAttribute that are applied to parameters.

When no attributes are found specifying the behavior, MVC matches method names and parameter names are matched using Exact and parameter types are matched using AssignableFrom.

ApiDescriptionActionData

Represents data used to build an ApiDescription, stored as part of the Properties.

ApiExplorerSettingsAttribute

Controls the visibility and group name for an ApiDescription of the associated controller class or action method.

AreaAttribute

Specifies the area containing a controller or action.

AutoValidateAntiforgeryTokenAttribute

An attribute that causes validation of antiforgery tokens for all unsafe HTTP methods. An antiforgery token is required for HTTP methods other than GET, HEAD, OPTIONS, and TRACE.

BadRequestObjectResult

An ObjectResult that when executed will produce a Bad Request (400) response.

BadRequestResult

A StatusCodeResult that when executed will produce a Bad Request (400) response.

BindAttribute

This attribute can be used on action parameters and types, to indicate model level metadata.

BindPropertiesAttribute

An attribute that enables binding for all properties the decorated controller or Razor Page model defines.

BindPropertyAttribute

An attribute that can specify a model name or type of IModelBinder to use for binding the associated property.

CacheProfile

Defines a set of settings which can be used for response caching.

ChallengeResult

An ActionResult that on execution invokes HttpContext.ChallengeAsync.

ClientErrorData

Information for producing client errors. This type is used to configure client errors produced by consumers of ClientErrorMapping.

ConflictObjectResult

An ObjectResult that when executed will produce a Conflict (409) response.

ConflictResult

A StatusCodeResult that when executed will produce a Conflict (409) response.

ConsumesAttribute

A filter that specifies the supported request content types. ContentTypes is used to select an action when there would otherwise be multiple matches.

ContentResult

An ActionResult that when executed will produce a response with content.

Controller

A base class for an MVC controller with view support.

ControllerAttribute

Indicates that the type and any derived types that this attribute is applied to are considered a controller by the default controller discovery mechanism, unless NonControllerAttribute is applied to any type in the hierarchy.

ControllerBase

A base class for an MVC controller without view support.

ControllerContext

The context associated with the current request for a controller.

ControllerContextAttribute

Specifies that a controller property should be set with the current ControllerContext when creating the controller. The property must have a public set method.

CookieTempDataProviderOptions

Provides programmatic configuration for cookies set by CookieTempDataProvider

CreatedAtActionResult

An ActionResult that returns a Created (201) response with a Location header.

CreatedAtRouteResult

An ActionResult that returns a Created (201) response with a Location header.

CreatedResult

An ActionResult that returns a Created (201) response with a Location header.

DefaultApiConventions

Default api conventions.

DisableRequestSizeLimitAttribute

Disables the request body size limit.

EmptyResult

Represents an ActionResult that when executed will do nothing.

FileContentResult

Represents an ActionResult that when executed will write a binary file to the response.

FileResult

Represents an ActionResult that when executed will write a file as the response.

FileStreamResult

Represents an ActionResult that when executed will write a file from a stream to the response.

ForbidResult

An ActionResult that on execution invokes HttpContext.ForbidAsync.

FormatFilterAttribute

A filter that will use the format value in the route data or query string to set the content type on an ObjectResult returned from an action.

FromBodyAttribute

Specifies that a parameter or property should be bound using the request body.

FromFormAttribute

Specifies that a parameter or property should be bound using form-data in the request body.

FromHeaderAttribute

Specifies that a parameter or property should be bound using the request headers.

FromQueryAttribute

Specifies that a parameter or property should be bound using the request query string.

FromRouteAttribute

Specifies that a parameter or property should be bound using route-data from the current request.

FromServicesAttribute

Specifies that a parameter or property should be bound using the request services.

HiddenInputAttribute

Indicates associated property or all properties with the associated type should be edited using an <input> element of type "hidden".

HttpDeleteAttribute

Identifies an action that supports the HTTP DELETE method.

HttpGetAttribute

Identifies an action that supports the HTTP GET method.

HttpHeadAttribute

Identifies an action that supports the HTTP HEAD method.

HttpOptionsAttribute

Identifies an action that supports the HTTP OPTIONS method.

HttpPatchAttribute

Identifies an action that supports the HTTP PATCH method.

HttpPostAttribute

Identifies an action that supports the HTTP POST method.

HttpPutAttribute

Identifies an action that supports the HTTP PUT method.

IgnoreAntiforgeryTokenAttribute

A filter that skips antiforgery token validation.

JsonOptions

Options to configure SystemTextJsonInputFormatter and SystemTextJsonOutputFormatter.

JsonPatchExtensions

Extensions for JsonPatchDocument<TModel>

JsonResult

An action result which formats the given object as JSON.

LocalRedirectResult

An ActionResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header to the supplied local URL.

MiddlewareFilterAttribute

Executes a middleware pipeline provided the by the ConfigurationType. The middleware pipeline will be treated as an async resource filter.

MiddlewareFilterAttribute<T>

Executes a middleware pipeline provided the by the ConfigurationType. The middleware pipeline will be treated as an async resource filter.

ModelBinderAttribute

An attribute that can specify a model name or type of IModelBinder to use for binding.

ModelBinderAttribute<TBinder>

An attribute that can specify a model name or type of IModelBinder to use for binding.

ModelMetadataTypeAttribute

This attribute specifies the metadata class to associate with a data model class.

ModelMetadataTypeAttribute<T>

This attribute specifies the metadata class to associate with a data model class.

MvcJsonOptions

Provides programmatic configuration for JSON in the MVC framework.

MvcNewtonsoftJsonOptions

Provides programmatic configuration for JSON formatters using Newtonsoft.JSON.

MvcOptions

Provides programmatic configuration for the MVC framework.

MvcViewOptions

Provides programmatic configuration for views in the MVC framework.

NoContentResult

A StatusCodeResult that when executed will produce a 204 No Content response.

NonActionAttribute

Indicates that a controller method is not an action method.

NonControllerAttribute

Indicates that the type and any derived types that this attribute is applied to is not considered a controller by the default controller discovery mechanism.

NonViewComponentAttribute

Indicates that the type and any derived types that this attribute is applied to is not considered a view component by the default view component discovery mechanism.

NotFoundObjectResult

An ObjectResult that when executed will produce a Not Found (404) response.

NotFoundResult

Represents an StatusCodeResult that when executed will produce a Not Found (404) response.

ObjectResult

An ActionResult that on execution will write an object to the response using mechanisms provided by the host.

OkObjectResult

An ObjectResult that when executed performs content negotiation, formats the entity body, and will produce a Status200OK response if negotiation and formatting succeed.

OkResult

An StatusCodeResult that when executed will produce an empty Status200OK response.

PageRemoteAttribute

A RemoteAttributeBase for razor page handler which configures Unobtrusive validation to send an Ajax request to the web site. The invoked handler should return JSON indicating whether the value is valid.

PartialViewResult

Represents an ActionResult that renders a partial view to the response.

PhysicalFileResult

A FileResult on execution will write a file from disk to the response using mechanisms provided by the host.

ProblemDetails

A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.

ProducesAttribute

A filter that specifies the expected Type the action will return and the supported response content types. The ContentTypes value is used to set ContentTypes.

ProducesAttribute<T>

A filter that specifies the expected Type the action will return and the supported response content types. The ContentTypes value is used to set ContentTypes.

ProducesDefaultResponseTypeAttribute

A filter that specifies the Type for all HTTP status codes that are not covered by ProducesResponseTypeAttribute.

ProducesErrorResponseTypeAttribute

Specifies the type returned by default by controllers annotated with ApiControllerAttribute.

Type specifies the error model type associated with a ProducesResponseTypeAttribute for a client error (HTTP Status Code 4xx) when no value is provided. When no value is specified, MVC assumes the client error type to be ProblemDetails, if mapping client errors (ClientErrorMapping) is used.

Use this Attribute to configure the default error type if your application uses a custom error type to respond.

ProducesResponseTypeAttribute

A filter that specifies the type of the value and status code returned by the action.

ProducesResponseTypeAttribute<T>

A filter that specifies the type of the value and status code returned by the action.

RazorViewEngineOptionsSetup

Sets up default options for RazorViewEngineOptions.

RedirectResult

An ActionResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header to the supplied URL.

RedirectToActionResult

An ActionResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header. Targets a controller action.

RedirectToPageResult

An ActionResult that returns a Found (302) or Moved Permanently (301) response with a Location header. Targets a registered route.

RedirectToRouteResult

An ActionResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header. Targets a registered route.

RemoteAttribute

A RemoteAttributeBase for controllers which configures Unobtrusive validation to send an Ajax request to the web site. The invoked action should return JSON indicating whether the value is valid.

RemoteAttributeBase

A ValidationAttribute which configures Unobtrusive validation to send an Ajax request to the web site. The invoked endpoint should return JSON indicating whether the value is valid.

RequestFormLimitsAttribute

Sets the specified limits to the Form.

RequestSizeLimitAttribute

Sets the request body size limit to the specified size.

RequireHttpsAttribute

An authorization filter that confirms requests are received over HTTPS.

ResponseCacheAttribute

Specifies the parameters necessary for setting appropriate headers in response caching.

RouteAttribute

Specifies an attribute route on a controller.

SerializableError

Defines a serializable container for storing ModelState information. This information is stored as key/value pairs.

ServiceFilterAttribute

A filter that finds another filter in an IServiceProvider.

ServiceFilterAttribute<TFilter>

A filter that finds another filter in an IServiceProvider.

SignInResult

An ActionResult that on execution invokes HttpContext.SignInAsync.

SignOutResult

An ActionResult that on execution invokes HttpContext.SignOutAsync.

SkipStatusCodePagesAttribute

A filter that prevents execution of the StatusCodePages middleware.

StatusCodeResult

Represents an ActionResult that when executed will produce an HTTP response with the given response status code.

TempDataAttribute

Properties decorated with TempDataAttribute will have their values stored in and loaded from the ITempDataDictionary. TempDataAttribute is supported on properties of Controllers, Razor Pages, and Razor Page Models.

TypeFilterAttribute

A filter that creates another filter of type ImplementationType, retrieving missing constructor arguments from dependency injection if available there.

TypeFilterAttribute<TFilter>

A filter that creates another filter of type ImplementationType, retrieving missing constructor arguments from dependency injection if available there.

UnauthorizedObjectResult

An ObjectResult that when executed will produce a Unauthorized (401) response.

UnauthorizedResult

Represents an UnauthorizedResult that when executed will produce an Unauthorized (401) response.

UnprocessableEntityObjectResult

An ObjectResult that when executed will produce a Unprocessable Entity (422) response.

UnprocessableEntityResult

A StatusCodeResult that when executed will produce a Unprocessable Entity (422) response.

UnsupportedMediaTypeResult

A StatusCodeResult that when executed will produce a UnsupportedMediaType (415) response.

UrlHelperExtensions

Static class for url helper extension methods.

ValidateAntiForgeryTokenAttribute

Specifies that the class or method that this attribute is applied validates the anti-forgery token. If the anti-forgery token is not available, or if the token is invalid, the validation will fail and the action method will not execute.

ValidationProblemDetails

A ProblemDetails for validation errors.

ViewComponent

A base class for view components.

ViewComponentAttribute

Indicates the class and all subclasses are view components. Optionally specifies a view component's name. If defining a base class for multiple view components, associate this attribute with that base.

ViewComponentResult

An IActionResult which renders a view component to the response.

ViewDataAttribute

Properties decorated with ViewDataAttribute will have their values stored in and loaded from the ViewDataDictionary. ViewDataDictionary is supported on properties of Controllers, and Razor Page handlers.

ViewResult

Represents an ActionResult that renders a view to the response.

VirtualFileResult

A FileResult that on execution writes the file specified using a virtual path to the response using mechanisms provided by the host.

Interfaces

IActionResult

Defines a contract that represents the result of an action method.

IDesignTimeMvcBuilderConfiguration

Configures the IMvcBuilder. Implement this interface to enable design-time configuration (for instance during pre-compilation of views) of IMvcBuilder.

IRequestFormLimitsPolicy

A marker interface for filters which define a policy for limits on a request's body read as a form.

IRequestSizePolicy

A marker interface for filters which define a policy for maximum size for the request body.

IUrlHelper

Defines the contract for the helper to build URLs for ASP.NET MVC within an application.

IViewComponentHelper

Supports the rendering of view components in a view.

IViewComponentResult

Result type of a ViewComponent.

Enums

CompatibilityVersion

Specifies the version compatibility of runtime behaviors configured by MvcOptions.

ResponseCacheLocation

Determines the value for the "Cache-control" header in the response.

Remarks

For an introduction to MVC, see Overview of ASP.NET Core MVC.