Here's my route setup:
routes.MapRoute(
name: "MyRoute",
url: "Secret/{source}/{display}/{sort}/{tags}/{filter}/{pageSize}/{page}",
defaults: new { controller = "Secret", action = "Index", page = 1, filter = "-", tags = "-" },
namespaces: new[] { "SomeProject.Controllers" }
);
When I access this URL:
http://localhost:12345/Secret/SourceHere/Gallery/Score/-/-/26
and my view has this markup:
<a href="@Url.Action("Index", new { tags = @tagInfo.Tag })">
then the resulting URL in the link is:
http://localhost:12345/Secret?tags=hello
Though I can't find official documentation for it, everything I read on SO, Google etc says that route values should be preserved. Well, I've worked around it by specifying all route values every time, but that sucks.
Why aren't my route values being preserved?
EDIT my answer below is not quite right. In another view/situation, the rules there do not apply. Can anyone explain in absolute certainty the rules for when route values are remembered or not?
Routes drive me effin' crazy.