user2837480
user2837480

Reputation: 369

MVC routes with different actions when path has similar pattern

In my MVC app I have two paths with a similar pattern and my route config file has methods like below.

routes.MapRoute(
         name: "Route1",
         url: "bookings/{username}",
         defaults: new { controller = "Booking", action = "UserBooknigs" }
         );    

routes.MapRoute(
         name: "Ruote2",
         url: "bookings/{username}/{id}",
         defaults: new { controller = "Booking", action = "LoadBooking" }
         );    

whichever path I access it calls both actions. How can I avoid this issue?

Upvotes: 0

Views: 101

Answers (0)

Related Questions