an asp.net routing issue

Posted by Adam Right on Stack Overflow See other posts from Stack Overflow or by Adam Right
Published on 2011-01-02T14:41:51Z Indexed on 2011/01/02 14:54 UTC
Read the original article Hit count: 183

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 ?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#-4.0