Freigeben über


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)

Syntax

'Declaration
Protected Friend Overridable Function GetControllerInstance ( _
    requestContext As RequestContext, _
    controllerType As Type _
) As IController
protected internal virtual IController GetControllerInstance(
    RequestContext requestContext,
    Type controllerType
)
protected public:
virtual IController^ GetControllerInstance(
    RequestContext^ requestContext, 
    Type^ controllerType
)

Parameters

  • controllerType
    Type: System.Type
    The type of the controller.

Return Value

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

Exceptions

Exception Condition
HttpException

controllerType is null reference (Nothing in Visual Basic).

ArgumentException

controllerType cannot be assigned.

InvalidOperationException

An instance of controllerType cannot be created.

See Also

Reference

DefaultControllerFactory Class

System.Web.Mvc Namespace