Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Microsoft.AspNetCore.Mvc Namespace

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Provides types required to build an MVC app.

Classes

NameDescription
AcceptedAtActionResult

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

AcceptedAtRouteResult

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

AcceptedResult

AnActionResult 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 currentActionContext when creating the controller. The property must have a publicset method.

ActionNameAttribute

Specifies the name of an action.

ActionResult

A default implementation ofIActionResult.

ActionResult<TValue>

A type that wraps either anTValue instance or anActionResult.

AntiforgeryValidationFailedResult

ABadRequestResult used for antiforgery validationfailures. UseIAntiforgeryValidationFailedResult tomatch for validation failures inside MVC result filters.

ApiBehaviorOptions

Options used to configure behavior for types annotated withApiControllerAttribute.

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 thedeveloper 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, seeApiController 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 appliesto an action.ApiConventionTypeAttribute for details about applying conventions atthe 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 arematched to an action method using rules specified byApiConventionNameMatchAttributethat may be applied to a method name or its parameters andApiConventionTypeMatchAttributethat are applied to parameters.

When no attributes are found specifying the behavior, MVC matches method names and parameter names are matchedusingExact and parameter types are matchedusingAssignableFrom.

ApiDescriptionActionData

Represents data used to build anApiDescription, stored as part of theProperties.

ApiExplorerSettingsAttribute

Controls the visibility and group name for anApiDescriptionof 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 antiforgerytoken is required for HTTP methods other than GET, HEAD, OPTIONS, and TRACE.

BadRequestObjectResult

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

BadRequestResult

AStatusCodeResult that whenexecuted 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 ofIModelBinder to use for binding theassociated property.

CacheProfile

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

ChallengeResult

AnActionResult that on execution invokesHttpContext.ChallengeAsync.

ClientErrorData

Information for producing client errors. This type is used to configure client errorsproduced by consumers ofClientErrorMapping.

ConflictObjectResult

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

ConflictResult

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

ConsumesAttribute

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

ContentResult

AnActionResult 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 toare considered a controller by the default controller discovery mechanism, unlessNonControllerAttribute 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 currentControllerContext when creating the controller. The property must have a publicset method.

CookieTempDataProviderOptions

Provides programmatic configuration for cookies set byCookieTempDataProvider

CreatedAtActionResult

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

CreatedAtRouteResult

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

CreatedResult

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

DefaultApiConventions

Default api conventions.

DisableRequestSizeLimitAttribute

Disables the request body size limit.

EmptyResult

Represents anActionResult that when executed willdo nothing.

FileContentResult

Represents anActionResult that when executed willwrite a binary file to the response.

FileResult

Represents anActionResult that when executed willwrite a file as the response.

FileStreamResult

Represents anActionResult that when executed willwrite a file from a stream to the response.

ForbidResult

AnActionResult that on execution invokesHttpContext.ForbidAsync.

FormatFilterAttribute

A filter that will use the format value in the route data or query string to set the content type on anObjectResult 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 configureSystemTextJsonInputFormatter andSystemTextJsonOutputFormatter.

JsonPatchExtensions

Extensions forJsonPatchDocument<TModel>

JsonResult

An action result which formats the given object as JSON.

LocalRedirectResult

AnActionResult 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 theConfigurationType.The middleware pipeline will be treated as an async resource filter.

MiddlewareFilterAttribute<T>

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

ModelBinderAttribute

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

ModelBinderAttribute<TBinder>

An attribute that can specify a model name or type ofIModelBinder 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

AStatusCodeResult 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 tois not considered a controller by the default controller discovery mechanism.

NonViewComponentAttribute

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

NotFoundObjectResult

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

NotFoundResult

Represents anStatusCodeResult that whenexecuted will produce a Not Found (404) response.

ObjectResult

AnActionResult that on execution will write an object to the responseusing mechanisms provided by the host.

OkObjectResult

AnObjectResult that when executed performs content negotiation, formats the entity body, andwill produce aStatus200OK response if negotiation and formatting succeed.

OkResult

AnStatusCodeResult that when executed will produce an emptyStatus200OK response.

PageRemoteAttribute

ARemoteAttributeBase for razor page handler which configures Unobtrusive validationto send an Ajax request to the web site. The invoked handler should return JSON indicatingwhether the value is valid.

PartialViewResult

Represents anActionResult that renders a partial view to the response.

PhysicalFileResult

AFileResult on execution will write a file from disk to the responseusing mechanisms provided by the host.

ProblemDetails

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

ProducesAttribute

A filter that specifies the expectedType the action will return and the supportedresponse content types. TheContentTypes value is used to setContentTypes.

ProducesAttribute<T>

A filter that specifies the expectedType the action will return and the supportedresponse content types. TheContentTypes value is used to setContentTypes.

ProducesDefaultResponseTypeAttribute

A filter that specifies theType for all HTTP status codes that are not covered byProducesResponseTypeAttribute.

ProducesErrorResponseTypeAttribute

Specifies the type returned by default by controllers annotated withApiControllerAttribute.

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

Use thisAttribute 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 forRazorViewEngineOptions.

RedirectResult

AnActionResult 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

AnActionResult 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

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

RedirectToRouteResult

AnActionResult 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

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

RemoteAttributeBase

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

RequestFormLimitsAttribute

Sets the specified limits to theForm.

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 anIServiceProvider.

ServiceFilterAttribute<TFilter>

A filter that finds another filter in anIServiceProvider.

SignInResult

AnActionResult that on execution invokesHttpContext.SignInAsync.

SignOutResult

AnActionResult that on execution invokesHttpContext.SignOutAsync.

SkipStatusCodePagesAttribute

A filter that prevents execution of the StatusCodePages middleware.

StatusCodeResult

Represents anActionResult that when executed willproduce an HTTP response with the given response status code.

TempDataAttribute

Properties decorated withTempDataAttribute will have their values stored inand loaded from theITempDataDictionary.TempDataAttributeis supported on properties of Controllers, Razor Pages, and Razor Page Models.

TypeFilterAttribute

A filter that creates another filter of typeImplementationType, retrieving missing constructorarguments from dependency injection if available there.

TypeFilterAttribute<TFilter>

A filter that creates another filter of typeImplementationType, retrieving missing constructorarguments from dependency injection if available there.

UnauthorizedObjectResult

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

UnauthorizedResult

Represents anUnauthorizedResult that whenexecuted will produce an Unauthorized (401) response.

UnprocessableEntityObjectResult

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

UnprocessableEntityResult

AStatusCodeResult that whenexecuted will produce a Unprocessable Entity (422) response.

UnsupportedMediaTypeResult

AStatusCodeResult that whenexecuted 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 failand the action method will not execute.

ValidationProblemDetails

AProblemDetails 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. Ifdefining a base class for multiple view components, associate this attribute with that base.

ViewComponentResult

AnIActionResult which renders a view component to the response.

ViewDataAttribute

Properties decorated withViewDataAttribute will have their values stored inand loaded from theViewDataDictionary.ViewDataDictionaryis supported on properties of Controllers, and Razor Page handlers.

ViewResult

Represents anActionResult that renders a view to the response.

VirtualFileResult

AFileResult that on execution writes the file specified using a virtual path to the responseusing mechanisms provided by the host.

Interfaces

NameDescription
IActionResult

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

IDesignTimeMvcBuilderConfiguration

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

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 aViewComponent.

Enums

NameDescription
CompatibilityVersion

Specifies the version compatibility of runtime behaviors configured byMvcOptions.

ResponseCacheLocation

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

Remarks

For an introduction to MVC, seeOverview of ASP.NET Core MVC.


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?