How to creat a URL Based on a Matching Route - General Discussions - General Discussions - Progress Community
 General Discussions

How to creat a URL Based on a Matching Route

  • How to creat a URL Based on a Matching Route
  • 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.





  • Is there anybody who knows?

  • 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 :

    Pavel Uzunov
    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