Export (0) Print
Expand All

HttpRouteCollectionExtensions.MapHttpRoute Method (HttpRouteCollection, String, String, Object, Object)

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

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

public static IHttpRoute MapHttpRoute(
	this HttpRouteCollection routes,
	string name,
	string routeTemplate,
	Object defaults,
	Object constraints


Type: System.Web.Http.HttpRouteCollection
A collection of routes for the application.
Type: System.String
The name of the route to map.
Type: System.String
The route template for the route.
Type: System.Object
An object that contains default route values.
Type: System.Object
A set of expressions that constrain the values for routeTemplate.

Return Value

Type: System.Web.Http.Routing.IHttpRoute
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 HttpRouteCollection. When you use instance method syntax to call this method, omit the first parameter. For more information, see http://msdn.microsoft.com/en-us/library/bb384936(v=vs.108).aspx or http://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).aspx.
© 2014 Microsoft