Solved

asp.net loginview not reflecting membership roles

Posted on 2009-07-08
3
464 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
[X]
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
  • 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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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