I have two routes I want mapped in my ASP.NET MVC application
- /User/Login
- /User/{userid}/{username}/{action} (e.g. /User/1/blah/profile)
Here are the routes I've defined:
routes.MapRoute(
"Profile",
"Users/{userID}/{username}/{action}",
new { controller = "Users", action = "Profile" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
This works great so far in most instances. The following URLs work from my home page:
<%= Html.ActionLink((UsersController x) => x.Login(), "Login") %>
<%= Html.ActionLink((UsersController x) => x.Profile(1, "blah") %>
These map to (respectfully):
/Users/Login /Users/1/blah
However, once I've navigated to /Users/1/blah, the login url immediately turns to /Users/1/blah/login. Any idea how to fix this?