Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

RouteCollectionExtensions.MapRoute Method

 

Maps the route.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String)

Maps the specified URL route.

System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String, Object)

Maps the specified URL route and sets default route values.

System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String, Object, Object)

Maps the specified URL route and sets default route values and constraints.

System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String, Object, Object, String[])

Maps the specified URL route and sets default route values, constraints, and namespaces.

System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String, Object, String[])

Maps the specified URL route and sets default route values and namespaces.

System_CAPS_pubmethodSystem_CAPS_staticMapRoute(RouteCollection, String, String, String[])

Maps the specified URL route and sets the namespaces.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String)

Maps the specified URL route.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String, Object)

Maps the specified URL route and sets default route values.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url,
	object defaults
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

defaults
Type: System.Object

An object that contains default route values.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String, Object, Object)

Maps the specified URL route and sets default route values and constraints.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url,
	object defaults,
	object constraints
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

defaults
Type: System.Object

An object that contains default route values.

constraints
Type: System.Object

A set of expressions that specify values for the url parameter.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String, Object, Object, String[])

Maps the specified URL route and sets default route values, constraints, and namespaces.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url,
	object defaults,
	object constraints,
	string[] namespaces
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

defaults
Type: System.Object

An object that contains default route values.

constraints
Type: System.Object

A set of expressions that specify values for the url parameter.

namespaces
Type: System.String[]

A set of namespaces for the application.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String, Object, String[])

Maps the specified URL route and sets default route values and namespaces.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url,
	object defaults,
	string[] namespaces
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

defaults
Type: System.Object

An object that contains default route values.

namespaces
Type: System.String[]

A set of namespaces for the application.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String, String[])

Maps the specified URL route and sets the namespaces.

public static Route MapRoute(
	this RouteCollection routes,
	string name,
	string url,
	string[] namespaces
)

Parameters

routes
Type: System.Web.Routing.RouteCollection

A collection of routes for the application.

name
Type: System.String

The name of the route to map.

url
Type: System.String

The URL pattern for the route.

namespaces
Type: System.String[]

A set of namespaces for the application.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top
Show:
© 2015 Microsoft