Hi folks,
I have the following one route, registered in my global.asax.
routes.MapRoute(
"Home", // Unique name
"", // Root url
new { controller = "Home", action = "Index",
tag = string.Empty, page = 1 }
);
kewl. when i start the site, it correctly picks up this route.
Now, when i try to programatically do the following, it returns NULL.
var pageLinkValueDictionary =
new RouteValueDictionar(linkWithoutPageValuesDictionary)
{{"page", 2}};
VirtualPathData virtualPathData =
RouteTable.Routes.GetVirtualPath(viewContext, "Home"
pageLinkValueDictionary);
// NOTE: pageLinkValueDictionary ==
// Key: Action, Value: Index; Key: page, Value: 2
Does anyone have any suggestions to why this would be happening?
I was under the impression that it would find the Home route but append any values not found as query string items?
cheers!
Update
Still no luck with this. Also, using the MVC RC, i now need to change the viewContext to veiwContext.RequestContext .. which compiles but i'm still getting a null result.
Update 2
When I have the route without the page=1
default item, the route IS FOUND.
eg.
routes.MapRoute(
"Home",
"",
new { controller = "Post", action = "Index", tags = string.Empty }
);
.. and RouteTable.Routes.GetVirtualPath
returns a VirtualPathData
instance. When i add the page=1
(default value) back in, the VirtualPathData
instance returned is null. ???????? Please help!