Solved

asp.net loginview not reflecting membership roles

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

13 Experts available now in Live!

Get 1:1 Help Now