Solved

Hide menu nodes based on roles

Posted on 2008-10-17
3
1,358 Views
Last Modified: 2012-05-05
Hello, I have a menu control on a page that is populate with the following site map:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/default.aspx " title="Home"  description="Home">
  <siteMapNode url="~/About.aspx" title="About"  description="About"/>
        <siteMapNode url="~/Contact.aspx" title="Contact"  description="Contact"/>
      <siteMapNode url="~/Join.aspx" title="Join"  description="Join"/>
 <siteMapNode url="~/Bondsman/Default.aspx" title="Bondsman" >
  </siteMapNode>
<siteMapNode url="~/BountyHunter/Default.aspx" title="Bounty Hunter" >
   </siteMapNode>
    </siteMapNode>
  </siteMap>

The bondsman and bountyhunter nodes go to sections of the site that only those roles are allowed to go. I want to hide these nodes until the user logs in. Then based on their particular row show the nodes.

I add the following in the web.config when using active directory and this works great. How is it accomplished with the asp.net membership provider?????

This is my location entries the the web.config.
 </location>
  <!--This security setting is for access to the bondsman folder-->
  <location path="Bondsman">
    <system.web>
      <authorization>
        <allow roles="Admin,Bondsman"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

  <!--This security setting is for access to the bountyhunter folder-->
  <location path="BountyHunter">
    <system.web>
      <authorization>
        <allow roles="Admin,BountyHunter"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>




0
Comment
Question by:gogetsome
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
tree33 earned 500 total points
ID: 22742670
0
 

Author Comment

by:gogetsome
ID: 22742965
Thanks for the link. I'm trying to make it work but in vb. I'm in the process of converting the class but having issues with ths sub

   Public Sub Init(ByVal context As System.Web.HttpApplication) Implements IHttpModule.Init

            context.AuthenticateRequest += New EventHandler(Me.AuthenticateRequest)
        End Sub

This is the error:

Error      1      'Public Event AuthenticateRequest(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.      
0
 

Author Closing Comment

by:gogetsome
ID: 31507222
Hey, I suppose that would work. but I also found that this does too:

   
     
     
   



The point are still your as your link was a viable solution.
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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

22 Experts available now in Live!

Get 1:1 Help Now