+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / How to creat a URL Based on a Matching Route

How to creat a URL Based on a Matching Route

3 posts, 0 answered
  1. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    17 Jul 2014
    Link to this post

    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

  2. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    18 Jul 2014 in reply to minco
    Link to this post

    Is there anybody who knows?

  3. Pavel Uzunov
    Pavel Uzunov avatar
    7 posts
    Registered:
    13 Sep 2016
    21 Jul 2014
    Link to this post
    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 'http://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
     
3 posts, 0 answered