Share via


RouteCollectionExtensions.MapRoute Method

Definition

Overloads

MapRoute(RouteCollection, String, String)

Maps the specified URL route.

MapRoute(RouteCollection, String, String, Object)

Maps the specified URL route and sets default route values.

MapRoute(RouteCollection, String, String, String[])

Maps the specified URL route and sets the namespaces.

MapRoute(RouteCollection, String, String, Object, Object)

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

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

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

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

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

MapRoute(RouteCollection, String, String)

Maps the specified URL route.

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url);
static member MapRoute : System.Web.Routing.RouteCollection * string * string -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

url
String

The URL pattern for the route.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to

MapRoute(RouteCollection, String, String, Object)

Maps the specified URL route and sets default route values.

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url, object defaults);
static member MapRoute : System.Web.Routing.RouteCollection * string * string * obj -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String, defaults As Object) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

url
String

The URL pattern for the route.

defaults
Object

An object that contains default route values.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to

MapRoute(RouteCollection, String, String, String[])

Maps the specified URL route and sets the namespaces.

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url, string[] namespaces);
static member MapRoute : System.Web.Routing.RouteCollection * string * string * string[] -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String, namespaces As String()) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

url
String

The URL pattern for the route.

namespaces
String[]

A set of namespaces for the application.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to

MapRoute(RouteCollection, String, String, Object, Object)

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

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url, object defaults, object constraints);
static member MapRoute : System.Web.Routing.RouteCollection * string * string * obj * obj -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String, defaults As Object, constraints As Object) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

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 values for the url parameter.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to

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

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

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url, object defaults, string[] namespaces);
static member MapRoute : System.Web.Routing.RouteCollection * string * string * obj * string[] -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String, defaults As Object, namespaces As String()) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

url
String

The URL pattern for the route.

defaults
Object

An object that contains default route values.

namespaces
String[]

A set of namespaces for the application.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to

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

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

public static System.Web.Routing.Route MapRoute (this System.Web.Routing.RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces);
static member MapRoute : System.Web.Routing.RouteCollection * string * string * obj * obj * string[] -> System.Web.Routing.Route
<Extension()>
Public Function MapRoute (routes As RouteCollection, name As String, url As String, defaults As Object, constraints As Object, namespaces As String()) As Route

Parameters

routes
RouteCollection

A collection of routes for the application.

name
String

The name of the route to map.

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 values for the url parameter.

namespaces
String[]

A set of namespaces for the application.

Returns

A reference to the mapped route.

Exceptions

The routes or url parameter is null.

Applies to