I have a Global.asax where I define routes (see RegisterRoutes method below)
I will have a lot of routes, so I would like keep this method in a separate static class, importing using a namespace in the Global Asax and use the method in the Application_Start.
Unfortunately I'm not able to do it.
So my question:
- Can I use static class in Global.asax?
If yes, how can I do it?
void RegisterRoutes(RouteCollection routes) { // Register a route for Categories/All routes.MapPageRoute( "All Categories", // Route name "Categories/All", // Route URL "~/AllCategories.aspx" // Web page to handle route ); // Register a route for Products/{ProductName} routes.MapPageRoute( "View Content", // Route name "Content/{ContentId}", // Route URL "~/Cms/FrontEndCms/Content.aspx" // Web page to handle route ); } protected void Application_Start(object sender, EventArgs e) { // ROUTING. RegisterRoutes(RouteTable.Routes); }