More in this section
Forums / General Discussions / Domain to Page Mapping?

Domain to Page Mapping?

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
6 posts, 0 answered
  1. tdekoekkoek
    tdekoekkoek avatar
    13 posts
    09 Nov 2006
    18 Aug 2009
    Link to this post
    The new feature list of 3.7 mentions domain page mapping, but I see no mention of it in the documentation.  I can guess what it is, but can someone clarify what it is and how to use it?


  2. Vlad
    Vlad avatar
    498 posts
    19 Jun 2017
    19 Aug 2009
    Link to this post
    Hello Trevor,

    We just posted a KB article, which describes this feature:“domain-–-page-mapping”-feature.aspx

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. tdekoekkoek
    tdekoekkoek avatar
    13 posts
    09 Nov 2006
    19 Aug 2009
    Link to this post
    This is awesome!  This is just what I was hoping this feature meant.  I was needing this feature now and dreading having to code this myself.


  4. Richard Baugh
    Richard Baugh avatar
    201 posts
    22 Aug 2012
    08 Apr 2010
    Link to this post
    I've got an issues with the domain mapping. I have setup a site that has the domain mapping and I am having problems with the SiteMap with regards to the RadPanelbar and setting the StartingNodeOffset to 1. Here is a mock of the page structure:
    -> Home
    -> About
        -> Sub About
    -> myDomain (Group Page) - used for [level 0]
        -> main [level 1]
        -> Level1 [level 1]
            -> Sub Level 1 [level 2]
            -> Sub Level 2 [level 2]

    So my normal site will default to the home page. I have mapped to the myDomain group page. So the navigation on myDomain should have the main and Level1 pages with Level1 having Sub Level 1 and Sub Level 2 as sub pages. As you can see from my mock sitemap, the subpages should be at level 2 in the SiteMapDataSource. With the SitePanelBar control having the StartingNodeOffset set to 1 and ShowStartingNode to true, we should be seeing the following in the RadPanelBar when navigating to Level 1:
    Level 1
    -> Sub Level 1
    -> Sub Level 2

    The problem is that when navigating to Level 1, the RadPanelBar is not showing up at all. When debugging the code for the SitePanelBar control, the RadPanelBar does not have any pages after RadPanelBar1.DataBind() is called. The foreach loop is exiting as the RadPanelBar1.GetAllItems() is returning nothing.

    I think this has to do with the mapping as when I navigate to the About page through the normal site, the SitePanelBar operates as expected. The problem only seems to occur when we are on the group page using the mapped domain.

    We are using 3.7 SP3 and this is still occurring.
  5. Richard Baugh
    Richard Baugh avatar
    201 posts
    22 Aug 2012
    09 Apr 2010
    Link to this post
    After looking into this issue, I have found that the way the sitemap is being built is where the problem is. While inspecting the source for the SiteMapDataSource control I found that in the GetNodes method is returning null. Here is the code that returns the null value:
    SiteMapNode currentNodeAndHintAncestorNodes = this.Provider.GetCurrentNodeAndHintAncestorNodes(-1);
        if (((currentNodeAndHintAncestorNodes == null) || !currentNodeAndHintAncestorNodes.IsDescendantOf(currentNode)) || currentNodeAndHintAncestorNodes.Equals(currentNode))
            return null;

    The currentNode item is being set to "myDomain" per my previous example, with the url of "~/main.aspx". The currentNodeAndHintAncestorNodes item is set with the url of "~/level1.aspx". So when the "currentNodeAndHintAncestorNodes.IsDescendantOf(currentNode)" method is called, the value returned is false since these two items are at the same level. The currentNode in a normal site would be returning RootNode. In this case the page "Level1" would be and descendant. If "myDomain" was currentNode with the url of "~/myDomain.aspx", then it would be a descendant and the nodes would be built out.
  6. Richard Baugh
    Richard Baugh avatar
    201 posts
    22 Aug 2012
    14 Apr 2010
    Link to this post
    I came up with a workaround, but not sure if there is a better approach. Here is what I came up with:
    01.private SiteMapNodeCollection GetNodes()
    03.    SiteMapNode currentNode = null;
    04.    int startingNodeOffset = this.StartingNodeOffset;
    05.    if (!string.IsNullOrEmpty(this.SiteMapDataSource1.StartingNodeUrl) && this.StartFromCurrentNode)
    06.    {
    07.        throw new InvalidOperationException("StartingNodeUrl and StartFromCurrentNode are both defined.");
    08.    }
    09.    if (this.StartFromCurrentNode)
    10.    {
    11.        currentNode = SiteMapDataSource1.Provider.CurrentNode;
    12.    }
    13.    else if (!string.IsNullOrEmpty(this.SiteMapDataSource1.StartingNodeUrl))
    14.    {
    15.        currentNode = SiteMapDataSource1.Provider.FindSiteMapNode(Telerik.Web.UrlPath.ResolveUrl(this.SiteMapDataSource1.StartingNodeUrl));
    16.        if (currentNode == null)
    17.        {
    18.            throw new ArgumentException("Cannot find url", "StartingNodeUrl");
    19.        }
    20.    }
    21.    else
    22.    {
    23.        currentNode = SiteMapDataSource1.Provider.RootNode;
    24.        if (CmsUrlMappingManager.Enabled && currentNode != null)
    25.            currentNode = currentNode.ParentNode;
    26.    }
    27.    if (currentNode == null)
    28.    {
    29.        return null;
    30.    }
    32.    if (startingNodeOffset <= 0)
    33.    {
    34.        if (startingNodeOffset != 0)
    35.        {
    36.            SiteMapDataSource1.Provider.HintNeighborhoodNodes(currentNode, Math.Abs(startingNodeOffset), 0);
    37.            SiteMapNode parentNode = currentNode.ParentNode;
    38.            while ((startingNodeOffset < 0) && (parentNode != null))
    39.            {
    40.                currentNode = currentNode.ParentNode;
    41.                parentNode = currentNode.ParentNode;
    42.                startingNodeOffset++;
    43.            }
    44.        }
    45.        return this.GetNodes(currentNode);
    46.    }
    47.    SiteMapNode currentNodeAndHintAncestorNodes = SiteMapDataSource1.Provider.GetCurrentNodeAndHintAncestorNodes(-1);
    48.    if (((currentNodeAndHintAncestorNodes == null) || !currentNodeAndHintAncestorNodes.IsDescendantOf(currentNode)) || currentNodeAndHintAncestorNodes.Equals(currentNode))
    49.    {
    50.        return null;
    51.    }
    52.    SiteMapNode node4 = currentNodeAndHintAncestorNodes;
    53.    for (int i = 0; i < startingNodeOffset; i++)
    54.    {
    55.        node4 = node4.ParentNode;
    56.        if ((node4 == null) || node4.Equals(currentNode))
    57.        {
    58.            return this.GetNodes(currentNodeAndHintAncestorNodes);
    59.        }
    60.    }
    61.    SiteMapNode node5 = currentNodeAndHintAncestorNodes;
    62.    while ((node4 != null) && !node4.Equals(currentNode))
    63.    {
    64.        node5 = node5.ParentNode;
    65.        node4 = node4.ParentNode;
    66.    }
    67.    return this.GetNodes(node5);
    70.private SiteMapNodeCollection GetNodes(SiteMapNode node)
    72.    if (this.ShowStartingNode)
    73.    {
    74.        return new SiteMapNodeCollection(node);
    75.    }
    76.    return node.ChildNodes;

    I copied the GetNodes method from the SiteMapDataSource control and made a simple modification. You will notice that on line 23, I am getting the RootNode from the SiteMapDataSource and then I check to see if the CmsUrlMappingManager is enabled. If it is and the root node is not null, I am getting the Parent of the root node. In my example, the root node would resolve to myDomain. With this check for CmsUrlMappingManager being enabled, I can then get the parent of myDomain which is "SiteMap". This one change will allow for the panelbar to populate correctly.

    The only other thing that was needed, was to removed the DataSourceID property from the RadPanelBar and then in the Page_Load method, I am setting the RadPanelBar's DataSource equal to the GetNodes() method. One thing that I noticed was that if you have already added the SitePanelBar control to a page or template, you will need to delete it and then re-add it. This is to remove the DataSourceID property from the Sitefinity settings saved to the DB. Without doing this, you will get an error that stated you cannot have multiple data source bindings.

    I hope this helps anyone else that might run into this issue. Maybe someone from Sitefinity knows of a better solution for this problem when using the UrlMapping service.
Register for webinar
6 posts, 0 answered