Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DefaultControllerFactory.GetControllerInstance Method

Retrieves the controller instance for the specified request context and controller type.

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

protected internal virtual IController GetControllerInstance(
	RequestContext requestContext,
	Type controllerType
)

Parameters

requestContext
Type: System.Web.Routing.RequestContext

The context of the HTTP request, which includes the HTTP context and route data.

controllerType
Type: System.Type

The type of the controller.

Return Value

Type: System.Web.Mvc.IController
The controller instance.

ExceptionCondition
HttpException

controllerType is null.

ArgumentException

controllerType cannot be assigned.

InvalidOperationException

An instance of controllerType cannot be created.

Show:
© 2015 Microsoft