Solved

Hide menu nodes based on roles

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

21 Experts available now in Live!

Get 1:1 Help Now