Class RouteCollectionExtensions
Extends a System.Web.Routing.RouteCollection object for MVC routing.
public static class RouteCollectionExtensions
- Inheritance
-
RouteCollectionExtensions
- Inherited Members
Methods
GetVirtualPathForArea(RouteCollection, RequestContext, string, RouteValueDictionary)
Returns an object that contains information about the route and virtual path that are the result of generating a URL in the current area.
public static VirtualPathData GetVirtualPathForArea(this RouteCollection routes, RequestContext requestContext, string name, RouteValueDictionary values)
Parameters
routesRouteCollectionAn object that contains the routes for the applications.
requestContextRequestContextAn object that encapsulates information about the requested route.
namestringThe name of the route to use when information about the URL path is retrieved.
valuesRouteValueDictionaryAn object that contains the parameters for a route.
Returns
- VirtualPathData
An object that contains information about the route and virtual path that are the result of generating a URL in the current area.
GetVirtualPathForArea(RouteCollection, RequestContext, RouteValueDictionary)
Returns an object that contains information about the route and virtual path that are the result of generating a URL in the current area.
public static VirtualPathData GetVirtualPathForArea(this RouteCollection routes, RequestContext requestContext, RouteValueDictionary values)
Parameters
routesRouteCollectionAn object that contains the routes for the applications.
requestContextRequestContextAn object that encapsulates information about the requested route.
valuesRouteValueDictionaryAn object that contains the parameters for a route.
Returns
- VirtualPathData
An object that contains information about the route and virtual path that are the result of generating a URL in the current area.
IgnoreRoute(RouteCollection, string)
Ignores the specified URL route for the given list of available routes.
public static void IgnoreRoute(this RouteCollection routes, string url)
Parameters
routesRouteCollectionA collection of routes for the application.
urlstringThe URL pattern for the route to ignore.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
IgnoreRoute(RouteCollection, string, object)
Ignores the specified URL route for the given list of the available routes and a list of constraints.
public static void IgnoreRoute(this RouteCollection routes, string url, object constraints)
Parameters
routesRouteCollectionA collection of routes for the application.
urlstringThe URL pattern for the route to ignore.
constraintsobjectA set of expressions that specify values for the
urlparameter.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string)
Maps the specified URL route.
public static Route MapRoute(this RouteCollection routes, string name, string url)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string, object)
Maps the specified URL route and sets default route values.
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string, object, object)
Maps the specified URL route and sets default route values and constraints.
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
constraintsobjectA set of expressions that specify values for the
urlparameter.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string, object, object, string[])
Maps the specified URL route and sets default route values, constraints, and namespaces.
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
constraintsobjectA set of expressions that specify values for the
urlparameter.namespacesstring[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string, object, string[])
Maps the specified URL route and sets default route values and namespaces.
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, string[] namespaces)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
defaultsobjectAn object that contains default route values.
namespacesstring[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.
MapRoute(RouteCollection, string, string, string[])
Maps the specified URL route and sets the namespaces.
public static Route MapRoute(this RouteCollection routes, string name, string url, string[] namespaces)
Parameters
routesRouteCollectionA collection of routes for the application.
namestringThe name of the route to map.
urlstringThe URL pattern for the route.
namespacesstring[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routesorurlparameter is null.