How to creat a URL Based on a Matching Route

Posted by Community Admin on 03-Aug-2018 04:23

How to creat a URL Based on a Matching Route

All Replies

Posted by Community Admin on 17-Jul-2014 00:00

Hi everybody,

I'm using sitefinity 6.3.  I just want to create custom route , but it dosen't work.

If i want to do this, how can i do  ?    This attach files is  my sample code.

 

 

Regards

Minco

Posted by Community Admin on 18-Jul-2014 00:00

Is there anybody who knows?

Posted by Community Admin on 21-Jul-2014 00:00

Hi Minco Zhou,

Thank you for contacting us.

In ASP.NET you would register your routes directly to the RouteTable.Routes collection on Application_Start in your Global.asax, this is too early for a Sitefinity application as it has not yet initialized all of its components, which happens on Bootstrapping. So actual Routes registration in Sitefinity happens inside our implementation of the RegisterRoutes method of the above discussed Telerik.Sitefinity.Abstractions.Bootstrapper class. When you hook to the Bootstrapper.Initialized event you have to filter by the CommandName argument of the event, to be able to plug your logic after the execution of our RegisterRoutes logic.

To put it more clearly - if you want 'yoursitedomain/customroute' to open the 'CustomPage.aspx' you'll need something like this:

protected void Application_Start(object sender, EventArgs e)
    Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += Bootstrapper_Initialized;
 
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
    if (e.CommandName == "RegisterRoutes")
    
        //register  route to the physical page ~/CustomPage.aspx
        System.Web.Routing.RouteTable.Routes.MapPageRoute("CustomPageRoute", "customroute", "~/CustomPage.aspx");
    

There is a detailed article on this subject : http://www.sitefinity.com/blogs/stanislav-velikovs-blog/2013/11/07/adding-custom-route-for-static-web-forms-in-sitefinity-sites

Regards,
Pavel Uzunov
Telerik
 
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed