Need help on Side tree menu

Topics: Web Client Software Factory, Project Management Forum, UIP Application Block discussion, User Forum
May 8, 2007 at 7:47 AM
Hi all

i need some help in side menu. I want to hide some of the nodes in the side tree menu based on the authentication and authorization.

can any one help me.....
Jan 4, 2008 at 12:43 PM

  • First, you must define authorization rules in the securityConfiguration section of your application configuration file:

<securityConfiguration defaultAuthorizationInstance="RuleProvider" defaultSecurityCacheInstance="">
<add type="Microsoft.Practices.EnterpriseLibrary.Security.AuthorizationRuleProvider, Microsoft.Practices.EnterpriseLibrary.Security, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="RuleProvider">
<add expression="R:Administrator" name="AllowAccessTransfers" />

  • Now, open the Web.config file located in the module folder of the DevelopmentWebsite site, and then add the rule nodes to the compositeWeb/authorization element:

<rule Url="~/EFT/Default.aspx" Rule="AllowAccessTransfers" />
<rule Url="~/EFT/LastTransferView.aspx" Rule="AllowAccessTransfers" />

Adding this XML restricts access to the module Web pages to users for which the evaluation of the AllowAccessTransfers rule returns true.

  • Finally, to add a node to the site map, you use the AddNode method of the ISiteMapBuilderService:

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
                SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("EFT", "~/EFT/Default.aspx", "EFT");
                siteMapBuilderService.AddNode(moduleNode, "AllowAccessTransfers");
                SiteMapNodeInfo transfersViewNode = new SiteMapNodeInfo("LastTransferView", "~/EFT/LastTransferView.aspx", "Transfers");
siteMapBuilderService.AddNode(transfersViewNode, moduleNode, "AllowAccessTransfers");

For a complete example, you can download the Hands-on Labs for WCSF June 2007 (Lab 06 - Authorization)


Sebastian Iacomuzzi