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
routes
RouteCollectionAn object that contains the routes for the applications.
requestContext
RequestContextAn object that encapsulates information about the requested route.
name
stringThe name of the route to use when information about the URL path is retrieved.
values
RouteValueDictionaryAn 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
routes
RouteCollectionAn object that contains the routes for the applications.
requestContext
RequestContextAn object that encapsulates information about the requested route.
values
RouteValueDictionaryAn 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
routes
RouteCollectionA collection of routes for the application.
url
stringThe URL pattern for the route to ignore.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
url
stringThe URL pattern for the route to ignore.
constraints
objectA set of expressions that specify values for the
url
parameter.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter is null.
MapRoute(RouteCollection, string, string)
Maps the specified URL route.
public static Route MapRoute(this RouteCollection routes, string name, string url)
Parameters
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
defaults
objectAn object that contains default route values.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
defaults
objectAn object that contains default route values.
constraints
objectA set of expressions that specify values for the
url
parameter.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
defaults
objectAn object that contains default route values.
constraints
objectA set of expressions that specify values for the
url
parameter.namespaces
string[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
defaults
objectAn object that contains default route values.
namespaces
string[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter 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
routes
RouteCollectionA collection of routes for the application.
name
stringThe name of the route to map.
url
stringThe URL pattern for the route.
namespaces
string[]A set of namespaces for the application.
Returns
- Route
A reference to the mapped route.
Exceptions
- ArgumentNullException
The
routes
orurl
parameter is null.