How to get route "name" when in route controller
Posted
by Murph
on Stack Overflow
See other posts from Stack Overflow
or by Murph
Published on 2009-05-06T18:45:31Z
Indexed on
2010/05/02
18:58 UTC
Read the original article
Hit count: 217
ASP.NET
|asp.net-mvc-routing
I'm using routing in asp.net to get nice URLs
When I define routes in global.asax I create two distinct routes that use the same controller (c#):
// Setup code for route a...
routes.Add("routeb", routea);
// Setup code for route b...
routes.Add("routeb", routeb);
(How) is it possible to determine from within the controller what the "key" value is that directed the user to this controller? Alternatively is the pattern of use wrong - it would be straightforward to subclass the Controller (again) to distinguish between the two and retain common code if that is a more appropriate solution.
© Stack Overflow or respective owner