I'm having a terrible time with a routing issue. Hopefully you can help me out.
Here are the URL's that work:
http://www.example.com/Stories/Action-Name/StoryName
http://www.example.com/Stories/Action-Name/ (it automatically redirects to ~/Stories/Action-Name/StoryName which is what I want.
However, if I remove the trailing "/" (i.e http://www.example.com/Stories/Action-Name) then it redirects to: http://www.example.com/StoryName
I have no idea how or why this is happening.
Here's the route I have setup in Global.asax:
routes.MapRoute("SurvivorStoriesRedirect", "Stories/Action-Name/{id}", new {
controller = "Stories",
action = "Action-Name",
id = UrlParameter.Optional
});
Please let me know what I'm doing wrong.
Thanks.
EDIT --
Not sure what or how I was messing this up but I just added this:
routes.MapRoute("SurvivorStoriesRedirect", "Stories/{action}/{id}", new {
controller = "Stories",
action = "Index",
id = UrlParameter.Optional
});
And removed any other routes for the "Stories" controller, and all seemed to work.