This is a migrated thread and some comments may be shown as answers.

Custom Routing

2 Answers 147 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kwena
Top achievements
Rank 1
Kwena asked on 06 Jul 2012, 06:38 AM
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 Answers, 1 is accepted

Sort by
0
Stanislav Velikov
Telerik team
answered on 11 Jul 2012, 06:20 AM
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
0
Kwena
Top achievements
Rank 1
answered on 11 Jul 2012, 06:37 AM
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() ) ); } }
Tags
General Discussions
Asked by
Kwena
Top achievements
Rank 1
Answers by
Stanislav Velikov
Telerik team
Kwena
Top achievements
Rank 1
Share this question
or