Multiple Menus Structures required

B

Bazza Formez

Hi,

I am building a new site where I want to utilise the new Menu control
feature with .Net 2.0.
I can see how this normally works, ie. by defining a SiteMapDataSource
control and use of the map.sitemap xml file which defines the menu
nodes & sub-nodes that will be used to build the menu.

My problem is this : I want the menu displayed to be dependent on the
role of the logged on user. If an Administrator logs in, I want to
display a very different menu to that which is to display when a
standard user logs in.

Is this possible ? I really need multiple versions of the web.sitemap
file .. & use the appropriate file for the role of the user. But, I
the web.sitemap is something that loads at application startup
apparently - and is shared for all users of the app in that case.

Surely this must be a common requirement (?)

Can anyone suggest anything ?

Thanks!
Bazza
 
B

Bazza Formez

Sorry ... ignore that post.

I can now see how this is done when I take a decent look in an example
map.sitemap file .. I see that for each node I can define the roles
that can see that node rendered in the menu...
eg. roles="ProjectManager,ProjectAdministrator"

Cheers,
Bazza
 
G

Guest

Hello Bazza,

What you want to do is doable with the asp.net membership provider and the
web.sitemap file. In the web.sitemap file specify the roles you want to for
each menu entry:
=-=-
<siteMapNode url="~/Admin/admin.aspx" title="Admin page" description="Do
admin stuff" roles="Admin" securitytrimmingEnabled="true" />
<siteMapNode url="~/Admin/PowerUser.aspx" title="Power User Page"
description="Power user" roles="Admin, Power User"
securitytrimmingEnabled="true"/>

=-=-=-
Those items will only show up on the menu for people who are logged in as
Admin's and/or Power Users.

Also, be sure to turn on Forms authentication in web.config along with
SecurityTrimmingEnabled for the sitemap provider:
=-=-=-=-
<authentication mode="Forms"/>
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<clear/>
<add name="XmlSiteMapProvider" description="Default SiteMap provider."
type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
=-=-=-

For a more thorough article on the subject checkout those four guys from
rolla - http://aspnet.4guysfromrolla.com/articles/122805-1.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top