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)
'Declaration Protected Friend Overridable Function GetControllerInstance ( _ requestContext As RequestContext, _ controllerType As Type _ ) As IController 'Usage Dim requestContext As RequestContext Dim controllerType As Type Dim returnValue As IController returnValue = Me.GetControllerInstance(requestContext, _ 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.
| Exception | Condition |
|---|---|
| HttpException | controllerType is Nothing. |
| ArgumentException | controllerType cannot be assigned. |
| InvalidOperationException | An instance of controllerType cannot be created. |
Show: