RouteCollectionExtensions.MapRoute Method

 

Maps the route.

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

Overload List

Name Description
System_CAPS_pubmethodSystem_CAPS_static MapRoute(RouteCollection, String, String)

Maps the specified URL route.

System_CAPS_pubmethodSystem_CAPS_static MapRoute(RouteCollection, String, String, Object)

Maps the specified URL route and sets default route values.

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

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

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

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

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

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

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

Maps the specified URL route and sets the namespaces.

See Also

RouteCollectionExtensions Class
System.Web.Mvc Namespace

Return to top

RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String)

Maps the specified URL route.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String
) As Route

Parameters

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exceptions

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.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url,
    object defaults
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url,
    Object^ defaults
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string *
        defaults:Object -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String,
    defaults As Object
) As Route

Parameters

  • defaults
    Type: System.Object

    An object that contains default route values.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exceptions

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.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url,
    object defaults,
    object constraints
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url,
    Object^ defaults,
    Object^ constraints
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string *
        defaults:Object *
        constraints:Object -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String,
    defaults As Object,
    constraints As Object
) As Route

Parameters

  • 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.

Exceptions

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.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url,
    object defaults,
    object constraints,
    string[] namespaces
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url,
    Object^ defaults,
    Object^ constraints,
    array<String^>^ namespaces
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string *
        defaults:Object *
        constraints:Object *
        namespaces:string[] -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String,
    defaults As Object,
    constraints As Object,
    namespaces As String()
) As Route

Parameters

  • 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.

Exceptions

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.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url,
    object defaults,
    string[] namespaces
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url,
    Object^ defaults,
    array<String^>^ namespaces
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string *
        defaults:Object *
        namespaces:string[] -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String,
    defaults As Object,
    namespaces As String()
) As Route

Parameters

  • 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.

Exceptions

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.

Syntax

public static Route MapRoute(
    this RouteCollection routes,
    string name,
    string url,
    string[] namespaces
)
public:
[ExtensionAttribute]
static Route^ MapRoute(
    RouteCollection^ routes,
    String^ name,
    String^ url,
    array<String^>^ namespaces
)
static member MapRoute : 
        routes:RouteCollection *
        name:string *
        url:string *
        namespaces:string[] -> Route
<ExtensionAttribute>
Public Shared Function MapRoute (
    routes As RouteCollection,
    name As String,
    url As String,
    namespaces As String()
) As Route

Parameters

  • namespaces
    Type: System.String[]

    A set of namespaces for the application.

Return Value

Type: System.Web.Routing.Route

A reference to the mapped route.

Exceptions

Exception Condition
ArgumentNullException

The routes or url parameter is null.

Return to top