Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Controller Class
Collapse the table of content
Expand the table of content

Controller Class

 

Provides methods that respond to HTTP requests that are made to an ASP.NET MVC Web site.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)


[<AbstractClass>]
type Controller = 
    class
        inherit ControllerBase
        interface IActionFilter
        interface IAuthenticationFilter
        interface IAuthorizationFilter
        interface IDisposable
        interface IExceptionFilter
        interface IResultFilter
        interface IAsyncController
        interface IController
        interface IAsyncManagerContainer
    end

NameDescription
System_CAPS_protmethodController()

Initializes a new instance of the Controller class.

NameDescription
System_CAPS_pubpropertyActionInvoker

Gets the action invoker for the controller.

System_CAPS_pubpropertyAsyncManager

Provides asynchronous operations.

System_CAPS_protpropertyBinders

Gets or sets the binder.

System_CAPS_pubpropertyControllerContext

Gets or sets the controller context.(Inherited from ControllerBase.)

System_CAPS_protpropertyDisableAsyncSupport

Gets whether to disable the asynchronous support for the controller.

System_CAPS_pubpropertyHttpContext

Gets HTTP-specific information about an individual HTTP request.

System_CAPS_pubpropertyModelState

Gets the model state dictionary object that contains the state of the model and of model-binding validation.

System_CAPS_pubpropertyProfile

Gets the HTTP context profile.

System_CAPS_pubpropertyRequest

Gets the HttpRequestBase object for the current HTTP request.

System_CAPS_pubpropertyResolver

Represents a replaceable dependency resolver providing services. By default, it uses the P:System.Web.Mvc.DependencyResolver.CurrentCache.

System_CAPS_pubpropertyResponse

Gets the HttpResponseBase object for the current HTTP response.

System_CAPS_pubpropertyRouteData

Gets the route data for the current request.

System_CAPS_pubpropertyServer

Gets the HttpServerUtilityBase object that provides methods that are used during Web request processing.

System_CAPS_pubpropertySession

Gets the HttpSessionStateBase object for the current HTTP request.

System_CAPS_pubpropertyTempData

Gets or sets the dictionary for temporary data.(Inherited from ControllerBase.)

System_CAPS_pubpropertyTempDataProvider

Gets the temporary-data provider object that is used to store data for the next request.

System_CAPS_pubpropertyUrl

Gets the URL helper object that is used to generate URLs by using routing.

System_CAPS_pubpropertyUser

Gets the user security information for the current HTTP request.

System_CAPS_pubpropertyValidateRequest

Gets or sets a value that indicates whether request validation is enabled for this request.(Inherited from ControllerBase.)

System_CAPS_pubpropertyValueProvider

Gets or sets the value provider for the controller.(Inherited from ControllerBase.)

System_CAPS_pubpropertyViewBag

Gets the dynamic view data dictionary.(Inherited from ControllerBase.)

System_CAPS_pubpropertyViewData

Gets or sets the dictionary for view data.(Inherited from ControllerBase.)

System_CAPS_pubpropertyViewEngineCollection

Gets the view engine collection.

NameDescription
System_CAPS_protmethodBeginExecute(RequestContext, AsyncCallback, Object)

Begins execution of the specified request context

System_CAPS_protmethodBeginExecuteCore(AsyncCallback, Object)

Begins to invoke the action in the current controller context.

System_CAPS_protmethodContent(String)

Creates a content result object by using a string.

System_CAPS_protmethodContent(String, String)

Creates a content result object by using a string and the content type.

System_CAPS_protmethodContent(String, String, Encoding)

Creates a content result object by using a string, the content type, and content encoding.

System_CAPS_protmethodCreateActionInvoker()

Creates an action invoker.

System_CAPS_protmethodCreateTempDataProvider()

Creates a temporary data provider.

System_CAPS_pubmethodDispose()

Releases all resources that are used by the current instance of the Controller class.

System_CAPS_protmethodDispose(Boolean)

Releases unmanaged resources and optionally releases managed resources.

System_CAPS_protmethodEndExecute(IAsyncResult)

Ends the invocation of the action in the current controller context.

System_CAPS_protmethodEndExecuteCore(IAsyncResult)

Ends the execute core.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodExecute(RequestContext)

Executes the specified request context.(Inherited from ControllerBase.)

System_CAPS_protmethodExecuteCore()

Invokes the action in the current controller context.(Overrides ControllerBase.ExecuteCore().)

System_CAPS_protmethodFile(Byte[], String)

Creates a FileContentResult object by using the file contents and file type.

System_CAPS_protmethodFile(Byte[], String, String)

Creates a FileContentResult object by using the file contents, content type, and the destination file name.

System_CAPS_protmethodFile(Stream, String)

Creates a FileStreamResult object by using the Stream object and content type.

System_CAPS_protmethodFile(Stream, String, String)

Creates a FileStreamResult object using the Stream object, the content type, and the target file name.

System_CAPS_protmethodFile(String, String)

Creates a FilePathResult object by using the file name and the content type.

System_CAPS_protmethodFile(String, String, String)

Creates a FilePathResult object by using the file name, the content type, and the file download name.

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodHandleUnknownAction(String)

Called when a request matches this controller, but no method with the specified action name is found in the controller.

System_CAPS_protmethodHttpNotFound()

Returns an instance of the HttpNotFoundResult class.

System_CAPS_protmethodHttpNotFound(String)

Returns an instance of the HttpNotFoundResult class.

System_CAPS_protmethodInitialize(RequestContext)

Initializes data that might not be available when the constructor is called.(Overrides ControllerBase.Initialize(RequestContext).)

System_CAPS_protmethodJavaScript(String)

Creates a JavaScriptResult object.

System_CAPS_protmethodJson(Object)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON).

System_CAPS_protmethodJson(Object, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified JSON request behavior.

System_CAPS_protmethodJson(Object, String)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

System_CAPS_protmethodJson(Object, String, Encoding)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format.

System_CAPS_protmethodJson(Object, String, Encoding, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the content type, content encoding, and the JSON request behavior.

System_CAPS_protmethodJson(Object, String, JsonRequestBehavior)

Creates a JsonResult object that serializes the specified object to JavaScript Object Notation (JSON) format using the specified content type and JSON request behavior.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethodOnActionExecuted(ActionExecutedContext)

Called after the action method is invoked.

System_CAPS_protmethodOnActionExecuting(ActionExecutingContext)

Called before the action method is invoked.

System_CAPS_protmethodOnAuthentication(AuthenticationContext)

Called when authorization occurs.

System_CAPS_protmethodOnAuthenticationChallenge(AuthenticationChallengeContext)

Called when authorization challenge occurs.

System_CAPS_protmethodOnAuthorization(AuthorizationContext)

Called when authorization occurs.

System_CAPS_protmethodOnException(ExceptionContext)

Called when an unhandled exception occurs in the action.

System_CAPS_protmethodOnResultExecuted(ResultExecutedContext)

Called after the action result that is returned by an action method is executed.

System_CAPS_protmethodOnResultExecuting(ResultExecutingContext)

Called before the action result that is returned by an action method is executed.

System_CAPS_protmethodPartialView()

Creates a PartialViewResult object that renders a partial view.

System_CAPS_protmethodPartialView(Object)

Creates a PartialViewResult object that renders a partial view, by using the specified model.

System_CAPS_protmethodPartialView(String)

Creates a PartialViewResult object that renders a partial view, by using the specified view name.

System_CAPS_protmethodPartialView(String, Object)

Creates a PartialViewResult object that renders a partial view, by using the specified view name and model.

System_CAPS_protmethodRedirect(String)

Creates a RedirectResult object that redirects to the specified URL.

System_CAPS_protmethodRedirectPermanent(String)

Returns an instance of the RedirectResult class with the Permanent property set to true.

System_CAPS_protmethodRedirectToAction(String)

Redirects to the specified action using the action name.

System_CAPS_protmethodRedirectToAction(String, Object)

Redirects to the specified action using the action name and route values.

System_CAPS_protmethodRedirectToAction(String, RouteValueDictionary)

Redirects to the specified action using the action name and route dictionary.

System_CAPS_protmethodRedirectToAction(String, String)

Redirects to the specified action using the action name and controller name.

System_CAPS_protmethodRedirectToAction(String, String, Object)

Redirects to the specified action using the action name, controller name, and route dictionary.

System_CAPS_protmethodRedirectToAction(String, String, RouteValueDictionary)

Redirects to the specified action using the action name, controller name, and route values.

System_CAPS_protmethodRedirectToActionPermanent(String)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name.

System_CAPS_protmethodRedirectToActionPermanent(String, Object)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name, and route values.

System_CAPS_protmethodRedirectToActionPermanent(String, RouteValueDictionary)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name, and route values.

System_CAPS_protmethodRedirectToActionPermanent(String, String)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name, and controller name.

System_CAPS_protmethodRedirectToActionPermanent(String, String, Object)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name, controller name, and route values.

System_CAPS_protmethodRedirectToActionPermanent(String, String, RouteValueDictionary)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified action name, controller name, and route values.

System_CAPS_protmethodRedirectToRoute(Object)

Redirects to the specified route using the specified route values.

System_CAPS_protmethodRedirectToRoute(RouteValueDictionary)

Redirects to the specified route using the route dictionary.

System_CAPS_protmethodRedirectToRoute(String)

Redirects to the specified route using the route name.

System_CAPS_protmethodRedirectToRoute(String, Object)

Redirects to the specified route using the route name and route values.

System_CAPS_protmethodRedirectToRoute(String, RouteValueDictionary)

Redirects to the specified route using the route name and route dictionary.

System_CAPS_protmethodRedirectToRoutePermanent(Object)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified route values.

System_CAPS_protmethodRedirectToRoutePermanent(RouteValueDictionary)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified route values.

System_CAPS_protmethodRedirectToRoutePermanent(String)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified route name.

System_CAPS_protmethodRedirectToRoutePermanent(String, Object)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified route name and route values.

System_CAPS_protmethodRedirectToRoutePermanent(String, RouteValueDictionary)

Returns an instance of the RedirectResult class with the Permanent property set to true using the specified route name and route values.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel)

Updates the specified model instance using values from the controller's current value provider.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, IValueProvider)

Updates the specified model instance using values from the value provider.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String)

Updates the specified model instance using values from the controller's current value provider and a prefix.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String, IValueProvider)

Updates the specified model instance using values from the value provider and a list of properties to include.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String, String[])

Updates the specified model instance using values from the controller's current value provider, a prefix, and included properties.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String, String[], IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, and included properties.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String, String[], String[])

Updates the specified model instance using values from the controller's current value provider, a prefix, a list of properties to exclude, and a list of properties to include.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String, String[], String[], IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, a list of properties to exclude , and a list of properties to include.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String[])

Updates the specified model instance using values from the controller's current value provider and included properties.

System_CAPS_protmethodTryUpdateModel<'TModel>('TModel, String[], IValueProvider)

Updates the specified model instance using values from the value provider and a list of properties to include.

System_CAPS_protmethodTryValidateModel(Object)

Validates the specified model instance.

System_CAPS_protmethodTryValidateModel(Object, String)

Validates the specified model instance using an HTML prefix.

System_CAPS_protmethodUpdateModel<'TModel>('TModel)

Updates the specified model instance using values from the controller's current value provider.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, IValueProvider)

Updates the specified model instance using values from the value provider.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String)

Updates the specified model instance using values from the controller's current value provider and a prefix.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String, IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, and a list of properties to include.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String, String[])

Updates the specified model instance using values from the controller's current value provider, a prefix, and included properties.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String, String[], IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, and a list of properties to include.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String, String[], String[])

Updates the specified model instance using values from the controller's current value provider, a prefix, a list of properties to exclude, and a list of properties to include.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String, String[], String[], IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, a list of properties to exclude, and a list of properties to include.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String[])

Updates the specified model instance using values from the controller object's current value provider.

System_CAPS_protmethodUpdateModel<'TModel>('TModel, String[], IValueProvider)

Updates the specified model instance using values from the value provider, a prefix, and a list of properties to include.

System_CAPS_protmethodValidateModel(Object)

Validates the specified model instance.

System_CAPS_protmethodValidateModel(Object, String)

Validates the specified model instance using an HTML prefix.

System_CAPS_protmethodView()

Creates a ViewResult object that renders a view to the response.

System_CAPS_protmethodView(IView)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(IView, Object)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(Object)

Creates a ViewResult object by using the model that renders a view to the response.

System_CAPS_protmethodView(String)

Creates a ViewResult object by using the view name that renders a view.

System_CAPS_protmethodView(String, Object)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(String, String)

Creates a ViewResult object using the view name and master-page name that renders a view to the response.

System_CAPS_protmethodView(String, String, Object)

Creates a ViewResult object using the view name, master-page name, and model that renders a view.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIAsyncController.BeginExecute(RequestContext, AsyncCallback, Object)

This method calls the BeginExecute method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAsyncController.EndExecute(IAsyncResult)

This method calls the EndExecute method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAuthenticationFilter.OnAuthentication(AuthenticationContext)

This method calls the OnAuthentication method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAuthenticationFilter.OnAuthenticationChallenge(AuthenticationChallengeContext)

This method calls the OnAuthenticationChallenge method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIActionFilter.OnActionExecuted(ActionExecutedContext)

This method calls the OnActionExecuted method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIActionFilter.OnActionExecuting(ActionExecutingContext)

This method calls the OnActionExecuting method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAuthorizationFilter.OnAuthorization(AuthorizationContext)

This method calls the OnAuthorization method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIController.Execute(RequestContext)

Executes the specified request context.(Inherited from ControllerBase.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIExceptionFilter.OnException(ExceptionContext)

This method calls the OnException method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIResultFilter.OnResultExecuted(ResultExecutedContext)

This method calls the OnResultExecuted method.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIResultFilter.OnResultExecuting(ResultExecutingContext)

This method calls the OnResultExecuting method.

A controller class name must end with "Controller". For example, a Product controller can be named ProductController but not Product or ProductCtrl.

The content last updated March 14, 2012

Controller action methods respond to requests that are sent to the controller. Controller action methods have the following restrictions:

  • Action methods must be public.

  • Action methods cannot be static.

  • Action methods cannot have unbounded generic type parameters. An unbounded generic type parameter has an empty parameter list. An unbounded generic type is also known as an open generic type. For information about unbounded generic type parameters, see the section "Unbounded Type Parameters" in Constraints on Type Parameters.

  • Action methods cannot be overloaded based on parameters. Action methods can be overloaded when they are disambiguated with attributes such as NonActionAttribute or AcceptVerbsAttribute.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2015 Microsoft