Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 482.2k

RoutConfigure more than two routes or one is enough?

Feb 7 2020 7:09 AM
Hi Mates
 
I want to have two unique routes one being normal  controller = Home, action = "Index"... . Is it possible to have a unique route within for example dashboard so that files dont get confused when loaded from the browser. My logic is as below;
 
  1. namespace ContentManagementSystem  
  2. {  
  3.     public class RouteConfig  
  4.     {  
  5.         public static void RegisterRoutes(RouteCollection routes)  
  6.         {  
  7.             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  
  8.   
  9.             routes.MapRoute(  
  10.                 name: "Default",  
  11.                 url: "{controller}/{action}/{id}",  
  12.                 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } // I already have this working fine  
  13.   
  14. defaults: new { controller = "Dashbaord", action = "_Index", id = UrlParameter.Optional  // I want to have seperate, but unique route for this controller for actionResult  
  15.   
  16.             );  
  17.   
  18.              
  19.         }  
  20.     }  
  21. }  
 

Answers (2)