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
)

Parameters

routes
Type: System.Web.Http.HttpRouteCollection
A collection of routes for the application.
name
Type: System.String
The name of the route to map.
routeTemplate
Type: System.String
The route template for the route.
defaults
Type: System.Object
An object that contains default route values.
constraints
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.
Show:
© 2014 Microsoft