RouteCollectionExtensions.MapRoute Method (RouteCollection, String, String)

Maps the specified URL route.

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

'Declaration
<ExtensionAttribute> _
Public Shared Function MapRoute ( _
	routes As RouteCollection, _
	name As String, _
	url As String _
) As Route
'Usage
Dim routes As RouteCollection
Dim name As String
Dim url As String
Dim returnValue As Route

returnValue = routes.MapRoute(name, _
	url)

Parameters

routes
Type: System.Web.Routing.RouteCollection
The routes.
name
Type: System.String
The route name.
url
Type: System.String
The URL.

Return Value

Type: System.Web.Routing.Route
A reference to the mapped route.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type RouteCollection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

ExceptionCondition
ArgumentNullException

The routes or url parameter is Nothing.

Community Additions

Show: