Custom Routing

3 posts, 0 answers
  1. Kwena
    Kwena avatar
    2 posts
    Member since:
    Oct 2010

    Posted 06 Jul 2012 Link to this post

    Hi,

    i have a problem, i recently found a solution to add my custom routes into Sitefinity tables.
    my route url is like this ("Catalogue/{category}").

    My problem is now my main menu treats the "catalogue" as a sub category in the link e.g. i have a news menu item which is supposed to redirect me to www.domain.com/news, but instead i get here www.domain.com/Catalogue/news, and that doesn't exist.

    is there a way to force sitefinity menu to resolve urls to read from root?

    Thanks.


  2. Stanislav Velikov
    Admin
    Stanislav Velikov avatar
    4 posts

    Posted 11 Jul 2012 Link to this post

    Hello,

    The navigation control in Sitefinity reads from SitefinitySiteMap which is an extended SiteMap control and as the roue was modified now I suppose if this is happening for www.domain.com/news it will happen for all pages created under the root (they will have www.domain.com/Catalogue/url).
    A temporary workaround can be to add the ~//Catalogue/url as additional url for news items.
    If you can share with me the routing logic used to get the catalogue added to the route so I can get better idea or the routing.

    Kind regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kwena
    Kwena avatar
    2 posts
    Member since:
    Oct 2010

    Posted 11 Jul 2012 Link to this post

    Hi Stanislav 

    Thanks for the reply.

    for now what i did was override the SiteMenu in C# and gave them absolute urls e.g. (
    smMainMenu.FindItemByText( "News" ).NavigateUrl = "//www.domain.com/news";)

    but here is how i added my custom routing in the Global.asax.

    Thanks

    
    
    Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>( Bootstrapper_Initialized );
    
    void
     Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)     {         if (args.CommandName == "RegisterRoutes")         {              var routes = (System.Web.Routing.RouteCollection)args.Data;  routes.Add( "RTCategory"new System.Web.Routing.Route"catalogue/{category}"new CatalogueRouteHandler() ) );  routes.Add( "RTProduct"new System.Web.Routing.Route"catalogue/{category}/{product}"new CatalogueRouteHandler() ) );  routes.Add( "RTManufacturer"new System.Web.Routing.Route"manufacturers/{manufacturer}"new CatalogueRouteHandler() ) ); } }
Back to Top