Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

asp.net loginview not reflecting membership roles

Posted on 2009-07-08
3
Medium Priority
?
467 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview

610 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