Solved

Hide menu nodes based on roles

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

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