Table of Contents

Class AreaRegistrationContext

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

Encapsulates the information that is required in order to register an area within an ASP.NET MVC application.

public class AreaRegistrationContext
Inheritance
AreaRegistrationContext
Inherited Members

Constructors

AreaRegistrationContext(string, RouteCollection)

Initializes a new instance of the AreaRegistrationContext class using the specified area name and routes collection.

public AreaRegistrationContext(string areaName, RouteCollection routes)

Parameters

areaName string

The name of the area to register.

routes RouteCollection

The collection of routes for the application.

AreaRegistrationContext(string, RouteCollection, object)

Initializes a new instance of the AreaRegistrationContext class using the specified area name, routes collection, and user-defined data.

public AreaRegistrationContext(string areaName, RouteCollection routes, object state)

Parameters

areaName string

The name of the area to register.

routes RouteCollection

The collection of routes for the application.

state object

An object that contains user-defined information to pass to the area.

Properties

AreaName

Gets the name of the area to register.

public string AreaName { get; }

Property Value

string

The name of the area to register.

Namespaces

Gets the namespaces for the application.

public ICollection<string> Namespaces { get; }

Property Value

ICollection<string>

An enumerable set of namespaces for the application.

Routes

Gets a collection of defined routes for the application.

public RouteCollection Routes { get; }

Property Value

RouteCollection

A collection of defined routes for the application.

State

Gets an object that contains user-defined information to pass to the area.

public object State { get; }

Property Value

object

An object that contains user-defined information to pass to the area.

Methods

MapRoute(string, string)

Maps the specified URL route and associates it with the area that is specified by the AreaName property.

public Route MapRoute(string name, string url)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.

MapRoute(string, string, object)

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values.

public Route MapRoute(string name, string url, object defaults)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

defaults object

An object that contains default route values.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.

MapRoute(string, string, object, object)

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values and constraint.

public Route MapRoute(string name, string url, object defaults, object constraints)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

defaults object

An object that contains default route values.

constraints object

A set of expressions that specify valid values for a URL parameter.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.

MapRoute(string, string, object, object, string[])

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values, constraints, and namespaces.

public Route MapRoute(string name, string url, object defaults, object constraints, string[] namespaces)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

defaults object

An object that contains default route values.

constraints object

A set of expressions that specify valid values for a URL parameter.

namespaces string[]

An enumerable set of namespaces for the application.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.

MapRoute(string, string, object, string[])

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values and namespaces.

public Route MapRoute(string name, string url, object defaults, string[] namespaces)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

defaults object

An object that contains default route values.

namespaces string[]

An enumerable set of namespaces for the application.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.

MapRoute(string, string, string[])

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified namespaces.

public Route MapRoute(string name, string url, string[] namespaces)

Parameters

name string

The name of the route.

url string

The URL pattern for the route.

namespaces string[]

An enumerable set of namespaces for the application.

Returns

Route

A reference to the mapped route.

Exceptions

ArgumentNullException

The url parameter is null.