Solved

asp.net loginview not reflecting membership roles

Posted on 2009-07-08
3
458 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now