SidD
SidD

Reputation: 6377

Route table in MVC storage location

I know in MVC at the application launch time the RegisterRoutes method is called in the Application_Start eventhandler of the global.asax. There is a collection of routes called the RouteCollection that contains all the registered routes in the application. RegisterRoutes method registers the routes in this collection. But I want to know where this route table is located is it in IIS. How can I locate it? For eg. I am running default MVC application where can I found this route table.

protected void Application_Start()
{
     RouteConfig.RegisterRoutes(RouteTable.Routes);
}

routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

Upvotes: 1

Views: 6259

Answers (3)

Yugraaj Sandhu
Yugraaj Sandhu

Reputation: 434

in Application memory of Server RAM where IIS is working. and as mentioned above RouteTable.Routes is a static reference to a RouteCollection

Upvotes: 0

Rohan Rao
Rohan Rao

Reputation: 2603

Well, before answering the question let me tell you that I think there is a confusion between Route and RouteTables. RouteTable is not stored anywhere, it a class by the way that stores the URL routes for your application. However, Routes are stored in a RouteTable.

So as I said, all the application Routes of are stored in RouteTable. The RouteTable is a global variable which is created when our MVC Application is started. This is shared across all the users using the application.

The RouteTable contains property by the name Routes (Routetable.Routes). It contains the collection of all the routes. We can add our own routes to this collection.

Reference from this link: RouteTable storage

Upvotes: 0

rism
rism

Reputation: 12142

It's "in memory". That's why you have to register it each time your app starts. RouteTable.Routes is a static reference to a RouteCollection.

So you can just call RouteTable.Routes to access it.

Upvotes: 1

Related Questions