I am using .Net 4.0 Routing and IIS 5.1
I have set up a test route as :
routes.MapPageRoute("onlineuniversity-catalog",
"onlineuniversity/catalog.aspx/{category}/{coursetype}",
"~/onlineuniversity/catalog.aspx");
I set up 3 test nav links as:
In Markup :
NavigateUrl="<%$RouteUrl:category=Insurance,coursetype=ContinuingEducation,routename=onlineuniversity-catalog%>"
NavigateUrl="~/OnlineUniversity/catalog.aspx/Insurance/ExamPrep">
and in Code behind as:
RouteValueDictionary parameters = new RouteValueDictionary
{
{"category", "Insurance" },
{ "coursetype", "PreLicense" } ,
};
VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, "onlineuniversity-catalog", parameters);
MenuOnlinePreLicense.NavigateUrl = vpd.VirtualPath;
All 3 links work and get me to the target page;
The target page checks the RouteData values in the page_load:
string sCategory = Page.RouteData.Values["category"].ToString();
string sCourseType = Page.RouteData.Values["coursetype"].ToString();
No matter which link I use RouteData.Values.Count = 0
Does anybody have any ideas why? I have been googling for about an hour to no avail.
I have set up a test route as :
routes.MapPageRoute("onlineuniversity-catalog",
"onlineuniversity/catalog.aspx/{category}/{coursetype}",
"~/onlineuniversity/catalog.aspx");
I set up 3 test nav links as:
In Markup :
NavigateUrl="<%$RouteUrl:category=Insurance,coursetype=ContinuingEducation,routename=onlineuniversity-catalog%>"
NavigateUrl="~/OnlineUniversity/catalog.aspx/Insurance/ExamPrep">
and in Code behind as:
RouteValueDictionary parameters = new RouteValueDictionary
{
{"category", "Insurance" },
{ "coursetype", "PreLicense" } ,
};
VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, "onlineuniversity-catalog", parameters);
MenuOnlinePreLicense.NavigateUrl = vpd.VirtualPath;
All 3 links work and get me to the target page;
The target page checks the RouteData values in the page_load:
string sCategory = Page.RouteData.Values["category"].ToString();
string sCourseType = Page.RouteData.Values["coursetype"].ToString();
No matter which link I use RouteData.Values.Count = 0
Does anybody have any ideas why? I have been googling for about an hour to no avail.