Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

asp.net loginview not reflecting membership roles

Posted on 2009-07-08
3
461 Views
Last Modified: 2013-12-17
I have a filtered menu in masterpage that comprises list items that I want to show hide depending on role - see my code snippet below

Regardless of what role I am in all menu options are being displayed.   I am using cassini and all membership and role is setup correctly.

Any answers?
<asp:LoginView runat="server" ID="menu">
        <AnonymousTemplate>
            <ul>
                <li><a id="link2" runat="server" href="~/default.aspx">Home</a></li></ul>
        </AnonymousTemplate>
        <RoleGroups>
            <asp:RoleGroup Roles="admin">
                <ContentTemplate>
                    <ul>
                        <li><a id="link2" runat="server" href="#">Home</a></li>                       
                        <li><a id="link3" runat="server" href="#">Admin</a></li>
                       
                    </ul>
                </ContentTemplate>
            </asp:RoleGroup>
            <asp:RoleGroup Roles="Editor">
                <ContentTemplate>
                    <ul>
                        <li><a id="link2" runat="server" href="#">Home</a></li>                       
                        <li><a id="link3" runat="server" href="#">Admin</a></li>
                    </ul>
                </ContentTemplate>
            </asp:RoleGroup>

Open in new window

0
Comment
Question by:mugsey
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
David Robitaille earned 500 total points
ID: 24803722
try to add a LoggedInTemplate
<asp:LoginView runat="server" ID="menu">
        <AnonymousTemplate>
            <ul>
                <li><a id="link2" runat="server" href="~/default.aspx">Home</a></li></ul>
        </AnonymousTemplate>
 <LoggedInTemplate>
            <ul>
                <li><a id="link2" runat="server" href="~/default.aspx">Home</a></li></ul>
        </LoggedInTemplate>
<RoleGroups>
            <asp:RoleGroup Roles="admin">
                <ContentTemplate>
                    <ul>
                        <li><a id="link2" runat="server" href="#">Home</a></li>                       
                        <li><a id="link3" runat="server" href="#">Admin</a></li>
                       
                    </ul>
                </ContentTemplate>
            </asp:RoleGroup>
            <asp:RoleGroup Roles="Editor">
                <ContentTemplate>
                    <ul>
                        <li><a id="link2" runat="server" href="#">Home</a></li>                       
                        <li><a id="link3" runat="server" href="#">Admin</a></li>
                    </ul>
                </ContentTemplate>
            </asp:RoleGroup>

Open in new window

0
 

Author Comment

by:mugsey
ID: 24803782
ok thanks I will try your suggestion and get back to you.  Does it matter that I am using asp.net development server (cassini) and not setting up via localhost IIS?
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24803971
it should work even if you use the development server
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question