an asp.net routing issue
- by Adam Right
my route implementation on Global.asax
protected void Application_Start(object sender, EventArgs e)
{
this.intRoutes(RouteTable.Routes);
}
void intRoutes(RouteCollection Rts)
{
Rts.MapPageRoute("search", "{language}/{page}", "~/search.aspx");
Rts.MapPageRoute("category", "{language}/{name}/{no}/{categoryname}", "~/category.aspx");
Rts.MapPageRoute("product", "{language}/{name}/{no}/{productname}", "~/product.aspx");
}
the problem is; if i use product routing on a hyperlink, like as follows;
<asp:HyperLink ID="hyProduct"
NavigateUrl='<%#HttpUtility.UrlDecode(((Page)HttpContext.Current.Handler).GetRouteUrl("product", new{ language=getUIFromHelper(),name=getNameFromHelper(),no=Eval("code"),productname=getProductNameFromHelper(Eval("name"))})) %>' runat="server" Text="something" />
everything goes fine, the link is written as expected like
/en/products/06.008.001.150.0510/davis-fish-seeker-green
but when i click that link the category.aspx page runs insted of product.aspx.
am i missing out something ?