All, my situation is that I have the basic route, plus some other simple routes:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = 1}
);
So the following url works: http://somesite.com/tags/index/1
However, some of my index pages take url parameters in the following fashion:
http://somesite.com/tags/index/1?when=lastmonth
How do I use Html.RouteLink to link to this?
You can't add '?' to routes in the global asax file like this:
routes.MapRoute("TagsWhen", "Tags/index/{id}?when={when}",
new {controller = "Tags", action = "Index", id = "", when = ""});
If this route worked I could link to it using:
Html.RouteLink(string.Format("{0} ", link.Rating), "LinksWhen",
new {id=link.ReferenceId, when=Model.When})
but it doesn't! So I'm not sure how I would use a Html.RouteLink to generate http://somesite.com/tags/index/1?when=lastmonth