Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472.6k

Routing pages to allow any controller except home

Dec 1 2020 6:49 AM
Hi Team
 
I have _SidebarMenuLayout, but i want to find a way to route to another controller not home( I have another unique controller name.).
 
  1. //_SideBarMenuLayout.cshtml  
  2. <!--Dashboard side bar menu-->  
  3.     <div class="sidebar-wrapper">  
  4.         <ul id="accordion" class="accordion">  
  5.             <li>  
  6.                 <!--Adding some submenu for accounts-->  
  7.                 <div class="link"><i class="fa fas fa-user-alt"></i>Accounts<i class="fa fa-chevron-down"></i></div>  
  8.                 <ul class="submenu">  
  9.                     <li><a href="@Url.RouteUrl("SuperAdmin")">SuperAdmin</a></li>  
  10.                     <li><a href="#">User-Account</a></li>  
  11.   
  12.                 </ul>  
  13.   
  14. // Route.config  
  15. // Route to SuperAdmin  
  16.             routes.MapRoute(  
  17.                 name:"SuperAdmin",  
  18.                 url:"administrator/",  
  19.                 defaults:new {controller= "Home", action= "SuperAdmin", url = UrlParameter.Optional}  
  20.              );  
  21.   
  22. // How to call this controller inside _SideBarMenuLayout.cshtml?  
  23.  // Rooute to AddtoCart.  
  24.             routes.MapRoute(  
  25.                 name: "eNtsaPaymentOrders/",  
  26.                 url:"add-to-card",  
  27.                 defaults:new {controller = "eNtsaAddToCard", action = "eNtsaPaymentOrders", id = UrlParameter.Optional }  
  28.              );  
 

Answers (5)