Table of Contents

Class ControllerContext

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Encapsulates information about an HTTP request that matches specified System.Web.Routing.RouteBase and ControllerBase instances.

public class ControllerContext
Inheritance
ControllerContext
Derived
Inherited Members

Constructors

ControllerContext()

Initializes a new instance of the ControllerContext class.

public ControllerContext()

ControllerContext(HttpContextBase, RouteData, ControllerBase)

Initializes a new instance of the ControllerContext class by using the specified HTTP context, URL route data, and controller.

public ControllerContext(HttpContextBase httpContext, RouteData routeData, ControllerBase controller)

Parameters

httpContext HttpContextBase

The HTTP context.

routeData RouteData

The route data.

controller ControllerBase

The controller.

ControllerContext(ControllerContext)

Initializes a new instance of the ControllerContext class by using the specified controller context.

protected ControllerContext(ControllerContext controllerContext)

Parameters

controllerContext ControllerContext

The controller context.

Exceptions

ArgumentNullException

The controllerContext parameter is null.

ControllerContext(RequestContext, ControllerBase)

Initializes a new instance of the ControllerContext class by using the specified request context and controller.

public ControllerContext(RequestContext requestContext, ControllerBase controller)

Parameters

requestContext RequestContext

The request context.

controller ControllerBase

The controller.

Exceptions

ArgumentNullException

One or both parameters are null.

Properties

Controller

Gets or sets the controller.

public virtual ControllerBase Controller { get; set; }

Property Value

ControllerBase

The controller.

DisplayMode

Gets the display mode.

public IDisplayMode DisplayMode { get; set; }

Property Value

IDisplayMode

The display mode.

HttpContext

Gets or sets the HTTP context.

public virtual HttpContextBase HttpContext { get; set; }

Property Value

HttpContextBase

The HTTP context.

IsChildAction

Gets a value that indicates whether the associated action method is a child action.

public virtual bool IsChildAction { get; }

Property Value

bool

true if the associated action method is a child action; otherwise, false.

ParentActionViewContext

Gets an object that contains the view context information for the parent action method.

public ViewContext ParentActionViewContext { get; }

Property Value

ViewContext

An object that contains the view context information for the parent action method.

RequestContext

Gets or sets the request context.

public RequestContext RequestContext { get; set; }

Property Value

RequestContext

The request context.

RouteData

Gets or sets the URL route data.

public virtual RouteData RouteData { get; set; }

Property Value

RouteData

The URL route data.