More in this section

Forums / General Discussions / Programatically add URL to pages.

Programatically add URL to pages.

2 posts, 0 answered
  1. Michael Cherry
    Michael Cherry avatar
    1 posts
    25 Feb 2010
    11 May 2011
    Link to this post
    We're attempting to add an alternate URL to pages imported from Sitefinity 3.x so the that migrated site will accept URLs such as as well as but are having difficulty getting the additional URLs associated with the pages.  The entries are showing up in the database, but they do not work on the site front end and do not appear in the Additional URLs text box when editing page properties.  Any help that could be provided in this matter would be appreciated.

    if (urlName.ToLower().IndexOf(".aspx") == -1)
        pageUrlData = new PageUrlData();
        pageUrlData.Id = Guid.NewGuid();
        pageUrlData.Url = "~/" + urlName + ".aspx";
        pageUrlData.IsDefault = false;
        pageUrlData.ApplicationName = pageData.ApplicationName;
        pageUrlData.Disabled = false;
        pageUrlData.LastModified = DateTime.Now;
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    06 Jul 2015
    12 May 2011
    Link to this post
    Hello Michael,

    Please refer to the code sample attached bellow which demonstrates the fluent api behavior when creating pages with additional urls.  You can customize it anyway you want in order to fit it to your needs.

    var pageFacade = App.WorkWith().Page().CreateNewStandardPage(PageLocation.Frontend); 
                var additionalUrl = "~/mypageredirect1"; 
                    .Do(p => 
                        p.Name = "mytest3"; 
                        p.Title = "mytitle3"; 
                        p.UrlName = "myurl"; 
                        p.ShowInNavigation = true; 
                        p.LastModified = DateTime.UtcNow; 
                        p.DateCreated = DateTime.UtcNow; 
                        p.Page.Title = "myname3"; 
                        //set title which appears in page header 
                        p.Page.HtmlTitle = "mytitle3"; 
                        p.Description = "mydesc3r"; 
                        p.AllowMultipleUrls = true; 
                        pageFacade.PageManager.AddPageNodeAdditionalUrl(p, CultureInfo.InvariantCulture, additionalUrl, false); 

    Victor Velev
    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
2 posts, 0 answered