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 (RouteCollection, String, String, Object, Object)

Maps the specified URL route.

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

[ExtensionAttribute]
public:
static Route^ MapRoute(
	RouteCollection^ routes, 
	String^ name, 
	String^ url, 
	Object^ defaults, 
	Object^ constraints
)

Parameters

routes
Type: System.Web.Routing::RouteCollection
The routes.
name
Type: System::String
The name.
url
Type: System::String
The URL.
defaults
Type: System::Object
The defaults.
constraints
Type: System::Object
The constraints.

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

Community Additions

Show:
© 2015 Microsoft