Provides a collection of routes for ASP.NET routing.
Assembly: System.Web.Routing (in System.Web.Routing.dll)
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class RouteCollection : public Collection<RouteBase^>
The class provides methods that enable you to manage a collection of objects that derive from the RouteBase class.
Typically, you will use the static Routes property of the RouteTable class to retrieve a object. The Routes property stores all the routes for an ASP.NET application. ASP.NET routing iterates through the routes in the Routes property to find the route that matches a URL.
To construct a URL, you call the GetVirtualPath method and pass in a collection of values. The GetVirtualPath method finds the first route with parameters that match the values that you passed in, and returns a VirtualPathData object that contains information about the matching route. You retrieve the URL through the VirtualPath property of the VirtualPathData object.
You can add a route either with a name or without a name. Including a name enables you to distinguish between similar routes when URLs are constructed. If you do not specify a name, ASP.NET routing uses the first matching route in the collection to construct a URL.
When you add an unnamed route to the object, you cannot add a route that already is in the collection. When you add a named route, you cannot use a name that already identifies a route in the collection.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.