views:

54

answers:

2

Hello all.

I'm currently using the good ol login control, .net membership & role providers for a web app I'm building. I have a tabbed navigation menu that I want to make role specific i.e. everyones sees 'Home', one role would be able to see additional tabs, another would be able to see three, etc.

Doe sthe allow for such a thing?

Has anyone created such a navigation menu and could point a newbie in the right direction?

Any help gratefully received.

A: 

You can use LoginView control to show/hide depending on role

           <asp:LoginView id="LoginView1" runat="server">
                <AnonymousTemplate>
                    Please log in for personalized information.
                </AnonymousTemplate>
                <LoggedInTemplate>
                    Thanks for logging in 
                    <asp:LoginName id="LoginName1" runat="Server"></asp:LoginName>.
                </LoggedInTemplate>
                <RoleGroups>
                    <asp:RoleGroup Roles="Admin">
                        <ContentTemplate>
                            <asp:LoginName id="LoginName2" runat="Server"></asp:LoginName>, you
                            are logged in as an administrator.
                        </ContentTemplate>
                    </asp:RoleGroup>
                </RoleGroups>
            </asp:LoginView>

from MSDN

Another approach I've used sometimes is create an ascx foreach role and load it dinamically and put on a Panel / Placeholder Controls collection.

Elph
+1  A: 

Use a SiteMap and enable SecurityTrimming. All SiteMap bound controls will now honor your roles.

Sky Sanders