If you have a route:
routes.MapRoute("search", "{controller}/{action}/{filter1}/{filter2}/{filter3}", _
New With {.filter1 = "", .filter2 = "", .filter3 = ""})
then in a view satisfied by the route pattern with a url of /member/search/dev/phil/hoy
, when you attempt to create another route url with only filter1
present i.e.
<%=Url.RouteUrl(New RouteValueDictionary(
New With {.controller="member",.action="search", .filter1="dev"}))%>
the result is the current route /member/search/dev/phil/hoy
, not the expected trimmed route /member/search/dev
I have managed to work round the issue by using RouteTable.Routes.GetVirtualPath
method directly, but does anyone know why it works this way or is it perhaps a bug?