Solved

asp.net loginview not reflecting membership roles

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 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