Warning: The question refers to the RC version of ASP.net MVC.
Problem is solved in ASP.net MVC 1.0
I have a page that requests some JSON from an Action on my controller and then fills a table with that data. In my JSON reponse, I'm including an anon object that contains some fields. One of those fields is a URL to another controller/action. I am setting the URL using Url.Action in my controller.
The problem is that the link that comes out is not valid (due to context I guess). For instance, the "hosting" page URL looks like this:
/Challenges/Detail/4/HEADLINE which is {controller}/{action}/{id}/{slug}
The URL in my json request calls the Profile action on my Account Controller. The URL should be something like this:
/Profile/username
However, it comes out as
../Profile/username
which resolves to
/Challenges/Detail/4/Profile/username
I'd like to avoid hardcoding any links if at all possible. What are my options here?