Creating a Role-Based Navigation System


Another useful capability that the user management feature offers is to assign roles to single navigation nodes. Elements marked like this will only be shown in the navigation controls if the user is a member of one of the assigned roles, similar to what was demonstrated in the earlier examples of the LoginView control.

The allocation of roles is already possible at present with the site map configuration file app.sitemap, which was presented in Chapter 5. The specification of roles in the file looks similar to the following:

 <?xml version="1.0" encoding="utf-8" ?> <siteMap>    <siteMapNode title="Home" description="Home" url="default.aspx" >       <siteMapNode title="Admin"           description="For admins only"           url="admin.aspx"           roles="Admins,SuperUsers"       />    </siteMapNode> </siteMap> 

The site navigation object model offers the deposited roles as a dictionary through the SiteMapNode.Roles property. But those roles are not being evaluated yet, so the navigation properties are shown completely unconditioned in the preceding example. This is another feature that will be available in the Beta version.




ASP. NET 2.0 Revealed
ASP.NET 2.0 Revealed
ISBN: 1590593375
EAN: 2147483647
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net