Udostępnij za pośrednictwem


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

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

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

Syntax

'Declaration
Public Function MapRoute ( _
    name As String, _
    url As String, _
    defaults As Object, _
    constraints As Object, _
    namespaces As String() _
) As Route
public Route MapRoute(
    string name,
    string url,
    Object defaults,
    Object constraints,
    string[] namespaces
)
public:
Route^ MapRoute(
    String^ name, 
    String^ url, 
    Object^ defaults, 
    Object^ constraints, 
    array<String^>^ namespaces
)

Parameters

  • 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.
  • namespaces
    Type: System.String[]
    An enumerable set of namespaces for the application.

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

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

See Also

Reference

AreaRegistrationContext Class

MapRoute Overload

System.Web.Mvc Namespace