I'm creating an application in MVC with some basic CMS like functionality. My goal is to have arbitrary routes like:
"http://www.example.com/Academics/Athletics/Football/Boys/Calendar"
to accomplish this, I've registered this route:
routes.MapRoute( "Default", "{*path}", new { Controller = "Content", action = "View" }
The View action method on the Content controller grabs the content from the database and renders it into the view.
All of this works great, but my outbound URL generation has issues.
This is basically how I'm rendering my menu urls:
(part of a HtmlHelper)
RouteValueDictionary dictionary = new RouteValueDictionary(); dictionary.Add( "path", navigation.Path ); var url = urlHelper.RouteUrl( "Default", dictionary );
Assume navigation.Path = "/about-us" Assume my site is "http://www.example.com"
I would expect the outbound route to be "http://www.example.com/about-us" but instead, it is "http://about-us"
I'm still learning about routing and I'm pretty confused by this one.
I appreciate any pointers!
Thanks.