Home > DeveloperSection > Forums > Issue in MVC routing
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    October-30-2014 12:23 AM

 ASP.NET MVC ASP.NET MVC  Mvc4 
Ratings:


 1 Reply(s)
 571  View(s)
Rate this:

I have a page that I want it to have 2 different routes: "/Admin/Schedules" AND "/Schedules"

"/Admin/Schedules" if for admin users and the page will render some admin features and it needs to log in... on the other hand, "/Schedules" is for non-logged users and it will render non-admin features...

But, the page is the same and I specifically need these two routes.



Alex Leblois
Alex Leblois

Total Post:67

Points:471
Posted on    October-30-2014 12:26 AM

you could accomplish this in the controller as ajma said by just having an if condition and a switch statement in a method that checks if the user exist like so:

if(UserID !=null)

{

 

   switch(UserPreference)

   {

       case 1:

                   action = "Schedules";

                   top = TypeOfPage.Admin;

                   view = "Schedules";

                   break;

        default:

                   action = "Schedules";

                   top = TypeOfPage.Nonuser;

                   view = "Schedules";

                   break;

    }

}

Don't want to miss updates? Please click the below button!

Follow MindStick