DefaultControllerFactory.GetControllerInstance Method (RequestContext, Type)

 

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)

No code example is currently available or this language may not be supported.

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.

Exception Condition
HttpException

controllerType is null.

ArgumentException

controllerType cannot be assigned.

InvalidOperationException

An instance of controllerType cannot be created.

Return to top
Show: