Solved

Hide menu nodes based on roles

Posted on 2008-10-17
3
1,384 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
[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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 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