Hello my fellow DaniWebers!

I have a question for you!

I have an ASP.Net website that I am currently working on. The problem that I am having is that I want to render the Master page's menu differently for the user types. Here is the catch. I can't use roles, only user names.

I have stared by creating different SiteMaps in the project, and Adding Multiple providers in the Web.config.

The menu is on the Master Page, and is bound with a SiteMapSource. This is a horizontal menu, and not a treeview. (Couple of Google results solved for a treeview.)

The question being; How do I bind the menu programmaticly on load by username? (AD Driven)

As far as I can tell:


Is null for the master page, but I can pass the username in from the default page. (or the login page)

Thanks for any ideas/help!

I posted this in VB.NET because of the code backend, or should I flag to move the post to ASP.NET?

Recommended Answers

All 4 Replies

i think you need to post on asp.net part....this is vb.net.

your problem i think User.Identity.Name still can use on master page, because i think i alredy make it on my project before.

Consider it moved.

commented: Thank you, Jim! +8

For you to use User.Identity.Name, the website needs to have anonymous authentication disabled and Windows authentication enabled (probably why you are getting null). You can use User.Identity.Name in the master page as well as aspx pages that link to a master page.

I actually ended up using a cookie that is stored upon log-on.

The problem persists with the site map. I can't figure out how to bind multiple sitemaps to multiple binding sources.

I have three sitemaps:

Basic User - A
Basic User - B

Only the administrator sitemap binds, but that is due to it being the original sitemap.
The other two are modified versions of the original.

I am wanting to only render menu items that are relevant to the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.