Export (0) Print
Expand All

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

Maps the specified route template and sets default route values, constraints, and end-point message handler.

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,
	HttpMessageHandler handler
)

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.

handler
Type: HttpMessageHandler

The handler to which the request will be dispatched.

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 https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).
Show:
© 2015 Microsoft