RouteTable is a class that stores URL routes for your application.
A RouteCollection provides a collection of route information that will be used when mapping URIs to controller actions.
RouteTable contains a Routes property that will return a RouteCollection . RouteTable uses RouteCollection to store all the URL routing information needed to accurately tell the URI the correct controller action.
In your global.asax, you will register routes that will be mapped to various controller actions by specifying the following:
Then the route will be added to the RouteCollection as follows:
/// <summary> /// Registers the routes used by the application. /// </summary> /// <param name="routes">Routes to register.</param> public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( "Error", "Error", new { controller = "Error", action = "Error" }); }
This shows how the actual route information is stored in the RouteCollection , which, in turn, is referenced via RouteTable .
source share