More in this section

Forums / Developing with Sitefinity / different SiteMap roots for specific users...

different SiteMap roots for specific users...

4 posts, 0 answered
  1. bleutiger
    bleutiger avatar
    153 posts
    Registered:
    23 Oct 2008
    03 Dec 2009
    Link to this post
    In this Article at the very end it talks about different sitemap roots for different users

    http://www.sitefinity.com/support/kb/sitefinity-3-x/the-%E2%80%9Cdomain-%E2%80%93-page-mapping%E2%80%9D-feature.aspx

    I was wondering if the KB article about this had ever been written or if someone could give an example of this.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Dec 2009
    Link to this post
    Hi bleutiger,

    This is implemented in Sitefinity from 3.7, so you do not have to write any code. You just need to make the configuration settings as suggested in the article.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. bleutiger
    bleutiger avatar
    153 posts
    Registered:
    23 Oct 2008
    03 Dec 2009
    Link to this post
    I understood the article and to be honest this is going to save me a ton of time for several project but I was specifically asking about the last paragraph and more specifically the last sentence of the article.

    However, it is easy to build a custom mapping, based on the current HttpContext like "User - Page mapping" or "Cookie - Page mapping", which defines different SiteMap roots for specific users or for specific value in the cookie. How to do this will be handled in another KB.

    Maybe I am missing something but I tend to be a visual learner so a sample of what is being discussed in that sentence would be a huge help to me.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Dec 2009
    Link to this post
    Hi bleutiger,

    You can create the following class in App_Code folder

    public class UserUrlMappingService : UrlMappingServiceBase
    {
        protected override string GetKey(HttpContext context)
        {
            RolePrincipal principal = context.User as RolePrincipal;
            if (principal != null)
                return context.User.Identity.Name;
            return string.Empty;
        }
    }

    Then change the url mapping as showb below:

    <urlMappings customService="UserUrlMappingService, App_Code" type="Custom">
            <add key="user1" value="user1page" />
            <add key="user2" value="user2page" />
         </urlMappings>

    You should create two users user1 and user2 and two pages user1page and user2page.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered