Table of Contents

Class ControllerBase

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

Represents the base class for all MVC controllers.

public abstract class ControllerBase : IController
Inheritance
ControllerBase
Implements
Derived
Inherited Members

Constructors

ControllerBase()

Initializes a new instance of the ControllerBase class.

protected ControllerBase()

Properties

ControllerContext

Gets or sets the controller context.

public ControllerContext ControllerContext { get; set; }

Property Value

ControllerContext

The controller context.

TempData

Gets or sets the dictionary for temporary data.

public TempDataDictionary TempData { get; set; }

Property Value

TempDataDictionary

The dictionary for temporary data.

ValidateRequest

Gets or sets a value that indicates whether request validation is enabled for this request.

public bool ValidateRequest { get; set; }

Property Value

bool

true if request validation is enabled for this request; otherwise, false. The default is true.

ValueProvider

Gets or sets the value provider for the controller.

public IValueProvider ValueProvider { get; set; }

Property Value

IValueProvider

The value provider for the controller.

ViewBag

Gets the dynamic view data dictionary.

public dynamic ViewBag { get; }

Property Value

dynamic

The dynamic view data dictionary.

ViewData

Gets or sets the dictionary for view data.

public ViewDataDictionary ViewData { get; set; }

Property Value

ViewDataDictionary

The dictionary for the view data.

Methods

Execute(RequestContext)

Executes the specified request context.

protected virtual void Execute(RequestContext requestContext)

Parameters

requestContext RequestContext

The request context.

Exceptions

ArgumentNullException

The requestContext parameter is null.

ExecuteCore()

Executes the request.

protected abstract void ExecuteCore()

Initialize(RequestContext)

Initializes the specified request context.

protected virtual void Initialize(RequestContext requestContext)

Parameters

requestContext RequestContext

The request context.