URL Rerouting does not appear to work in SiteFinity Version

Posted by Community Admin on 04-Aug-2018 22:40

URL Rerouting does not appear to work in SiteFinity Version 4.3.1885.0

All Replies

Posted by Community Admin on 21-Jan-2012 00:00

I am attempting to create a User Friendly URL. So the Search Engines can index more easily and our customers can refere to it easily.  So I first created a simple web form; outside the scope of the SiteFinity UI for a proof of concept.  I also did this on my localhost (which does not use SiteFinity).

the localhost (.net 4.0) worked great.
The Sitefinity Site gave me the 404 page not found error.

Both global.asax files are wired the same; Both forms are wired exactly the same.

Is this a bug or is their a work around for this issue.

URL:  http://localhost/Courses/297/CourseTitle
URL: http://www.sitefinitysampelsite.com/Courses/297/CourseTitle

I used these two sites as references about how to do this:

Here is my Code Sample>  OF COURSE IN a production environment I would use a SiteFinity
Page with a Custom Control inserted into the page using the UI.

    void Application_Start(object sender, EventArgs e)
        // Code that runs on application startup
    public static void RegisterSafetyCouncilRoutes(System.Web.Routing.RouteCollection reqRouteCollection)
        reqRouteCollection.MapPageRoute("RouteForCourses", "Courses/CourseId/CourseName", "~/TestPageNew.aspx");
    protected void Page_Load(object sender, EventArgs e)
    private void ProcessMyPageRequest()
        lblTroubleShooting.Text = "";
            string locCrsId = "";
            string locCrsName = "";
            locCrsId = Page.RouteData.Values["CourseId"].ToString();
            locCrsName = Page.RouteData.Values["CourseName"].ToString();
            lblTroubleShooting.Text += "<h1>Training Course Details page</h1>";
            lblTroubleShooting.Text  += string.Format("Displaying information for course ID : 0", locCrsId);
            lblTroubleShooting.Text  +="<br/><br/>";
            lblTroubleShooting.Text  +=string.Format("Displaying information for course Name : 0", locCrsName);
        catch (Exception ex)
            string locException = ex.ToString();
            lblTroubleShooting.Text  +="<br/>Exception Occurred: Requested Course Names could not be found<br/>";

Doug Lubey of Louisiana

To note: I did find a url which on the forums which spoke about this; but it appeared outdated.  http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/394951-url-rerouting.aspx

Search Engine Tags:
Url Re Route
Telerik SiteFinity CMS ReRouting ReWriting
How to change querystrings into nice urls and uri

Posted by Community Admin on 21-Jan-2012 00:00

OK...Yes it does work with a slight modification to my original global.asax code: 
Found the little bit of magic at this URL.

which pointed me in the correct direction.

//Modified the Global.asax file as shown
    void Application_Start(object sender, EventArgs e)
        // Code that runs on application startup
        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")
            System.Web.Routing.RouteCollection locRouteCollection = System.Web.Routing.RouteTable.Routes;
            locRouteCollection.MapPageRoute("RouteForCourses", "Courses/CourseId/CourseName", "~/TestPageNew.aspx");

works like a charm !!!
Thanks Telerik

-doug lubey of louisiana

Master/Detail webforms
URL readability
Address line user experience is better

This thread is closed