Solved

asp.net loginview not reflecting membership roles

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Technology Resume 7 71
API v SOA 8 42
how to check mis-spellings in a select SQL 2 39
Query in AngularJS 8 53
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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