• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

Assigning users to a role without using ASP.NET Configuration

I want to assign users to a role when they register on my site
automatically so that I can specify what they do and dont
see on the menu that uses the web.sitemap file. Can I do this so that
I don't have to do it manually with the ASP.NET configuration tool ?
If not, what is another way I can do this while using a sitemapdatasource
with the web.sitemap file.
(Anonymous users and registered users must see different menus)
1 Solution
proper way http://msdn2.microsoft.com/en-us/library/ms178428.aspx

one other way - on page loads check if the user is logged in eg forms authentication and display correct sitemap
setup multiple sitemaps:

then check if the user is authenticated on page load

if (HttpContext.Current.User.Identity.IsAuthenticated)
        //check if it is forms auth
         if (HttpContext.Current.User.Identity is FormsIdentity)
                 // set the relevant SiteMapProvider property to Company1SiteMap as the user is logged in
                 // set the relevant SiteMapProvider property to Company2SiteMap.
        //set the relevant SiteMapProvider property to Company2SiteMap.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now