AreaRegistrationContext.MapRoute Method (String, String, Object, Object)

Maps the specified URL route and associates it with the area that is specified by the AreaName property, using the specified route default values and constraint.

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


Public Function MapRoute ( _
    name As String, _
    url As String, _
    defaults As Object, _
    constraints As Object _
) As Route
Dim instance As AreaRegistrationContext
Dim name As String
Dim url As String
Dim defaults As Object
Dim constraints As Object
Dim returnValue As Route

returnValue = instance.MapRoute(name, _
    url, defaults, constraints)
public Route MapRoute(
    string name,
    string url,
    Object defaults,
    Object constraints
Route^ MapRoute(
    String^ name, 
    String^ url, 
    Object^ defaults, 
    Object^ constraints
public function MapRoute(
    name : String, 
    url : String, 
    defaults : Object, 
    constraints : Object
) : Route


  • defaults
    Type: System.Object
    An object that contains default route values.
  • constraints
    Type: System.Object
    A set of expressions that specify valid values for a URL parameter.

Return Value

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


Exception Condition

The url parameter is nulla null reference (Nothing in Visual Basic).

See Also


AreaRegistrationContext Class

MapRoute Overload

System.Web.Mvc Namespace