More in this section

Forums / Developing with Sitefinity / Role-Based Navigation and Pages

Role-Based Navigation and Pages

2 posts, 0 answered
  1. stephen
    stephen avatar
    1 posts
    Registered:
    24 Jun 2008
    26 Nov 2008
    Link to this post
    My site is using membership roles to manage access to specific parts of the web-site. By using anonymous access and page permissions I can get part of the way there, but not fully. What I need is this:

    Menu structure with a grouped tab. If the user is generic public then only display the top level and redirect to a page providing information on membership etc.
    However if the user is logged in then the menu is fully populated and selecting the top level page redirects to first sub-page per normal.

    Right now I can set it up so everything works just right except if a non-member selects the top menu tab, it redirects to my login page. I can't change that because other parts of my site need the login redirection, so I can't use that workaround.

    I have an idea, but how do I put code in the page load function of a dynamically generated page in sitefinity.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Nov 2008
    Link to this post
    Hi stephen,

    Here is an example where I am working with the SiteMenu. All non authenticated users will be redirected to an custom page when click on the link.

        public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
            //check whether the user is authenticated. 
            if (!Page.User.Identity.IsAuthenticated) 
                //redirect to membership sign up page, 
                e.Item.NavigateUrl = "http://www.yahoo.com";  
     
            if (this.hideUrlForGroupPages) 
            { 
                CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode; 
                if (node != null && node.PageType == CmsPageType.Group) 
                { 
                    e.Item.NavigateUrl = ""
                } 
            } 

    I hope this helps.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered