Controllers
public abstract class Controller : ControllerBase
Represents a base class for controllers in an MVC application.
namespace: Microsoft.AspNetCore.Mvc
type: class
public abstract class ControllerBase
A base class that provides essential MVC controller functionality.
namespace: Microsoft.AspNetCore.Mvc
type: class
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public sealed class ApiControllerAttribute : Attribute
Indicates that a controller is an API controller, enabling API-specific behaviors.
namespace: Microsoft.AspNetCore.Mvc
type: class
Action Methods
public abstract class Action : Attribute
Base class for action method attributes.
namespace: Microsoft.AspNetCore.Mvc
type: class
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public sealed class HttpGetAttribute : MethodAttribute
Constrains requests to HTTP GET.
namespace: Microsoft.AspNetCore.Mvc
type: class
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public sealed class HttpPostAttribute : MethodAttribute
Constrains requests to HTTP POST.
namespace: Microsoft.AspNetCore.Mvc
type: class
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class ActionNameAttribute : Attribute
Specifies the name of an action method.
namespace: Microsoft.AspNetCore.Mvc
type: class
Filters
public interface IActionFilter
Interface for action filters.
- void OnActionExecuting(ActionExecutingContext context);
- void OnActionExecuted(ActionExecutedContext context);
namespace: Microsoft.AspNetCore.Mvc.Filters
type: interface
public interface IResultFilter
Interface for result filters.
- void OnResultExecuting(ResultExecutingContext context);
- void OnResultExecuted(ResultExecutedContext context);
namespace: Microsoft.AspNetCore.Mvc.Filters
type: interface
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class AuthorizeAttribute : Attribute, IAuthorizationFilter
Specifies that an action or controller requires authorization.
namespace: Microsoft.AspNetCore.Authorization
type: class
Model Binding
public interface IModelBinder
Interface for model binders.
- Task BindModelAsync(ModelBindingContext bindingContext);
namespace: Microsoft.AspNetCore.Mvc.ModelBinding
type: interface
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public abstract class BindAttribute : Attribute
Specifies that a parameter or property should be bound.
namespace: Microsoft.AspNetCore.Mvc
type: class
View Data
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ViewDataAttribute : Attribute
Provides a mechanism to pass data to views.
namespace: Microsoft.AspNetCore.Mvc
type: class
public dynamic ViewBag { get; }
A dynamic property bag that allows you to set arbitrary properties and access them from the view.
namespace: Microsoft.AspNetCore.Mvc
type: property
Routing
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class RouteAttribute : Attribute
Specifies a route template for the associated action or controller.
namespace: Microsoft.AspNetCore.Mvc
type: class
public interface IRouter
Interface for route handlers.
- Task RouteAsync(RouteContext context);
namespace: Microsoft.AspNetCore.Routing
type: interface
Result Types
public interface IActionResult
Represents an action result.
- Task ExecuteResultAsync(ActionContext context);
namespace: Microsoft.AspNetCore.Mvc
type: interface
public sealed class OkResult : StatusCodeResult
An action result that returns an empty OK (200) response.
namespace: Microsoft.AspNetCore.Mvc
type: class
public sealed class NotFoundResult : StatusCodeResult
An action result that returns a Not Found (404) response.
namespace: Microsoft.AspNetCore.Mvc
type: class
public class JsonResult : ActionResult<object>
An action result that returns a JSON response.
namespace: Microsoft.AspNetCore.Mvc
type: class