Trouble with ApplicationSiteMap

Topics: Web Client Software Factory, User Forum
Mar 14, 2008 at 3:47 PM
Edited Mar 14, 2008 at 3:49 PM

I'm new with WCSF and I am having a trouble. I want to write this and ask if somebody know about it and can help me.

The question is: I specify in the Web.Config different Access Rules for the pages in my site according to the user´s roles. I register the pages in the ModuleInitializer of every project and add some nodes according to the functions of the site, adding the rule for the page in the overload for the AddNode method, like this:

SiteMapNodeInfo node = new SiteMapNodeInfo("Page1", "~/Page1.aspx", "Page 1");
siteMapBuilderService.AddNode(node, moduleNode, "RuleName");

If one user isn´t in a role specified in the rule for a page, they can´t access it. This works fine in my application. The trouble comes when I add the ApplicationSiteMap as DataSource of an ASP Menu Control. I understand that if one user doesn´t have authorization for one page and he can´t access it, then the page should not appear in the menu that I am building with the ApplicationSiteMap, but the page appears in my menu every time, even if the user don´t have permission to access it.

Could someone suggest a solution?... am I wrong?... how can I dinamically build the menu only with the pages authorized to the roles of the user authenticated?...

Thanks a lot...
Apr 8, 2008 at 1:38 PM
It is as you said, the pages that the user have not permission to access should not appear on the menu.
Are you using the Security Application Block of Enterprise Library for authorization? If not, that functionality won’t work by default, if yes, maybe you are missing some Web.Config settings. I suggest you read the Hands on Lab 6 – Authorization and check if you are missing any step, also you may check the WCSF doc.:
  • How to: Add Module Pages to the Site Map
  • How to: Authorize Web Pages

Please let me know if this helps.

Jonathan Cisneros
Apr 9, 2008 at 1:40 PM
Hi Jonathan.

First, thanks for answer. Finally I could do the menu. Really I didn't know what happen when I make it the first time, because like I post here, the menu didn't work. I undo all the changes, and started again to build the ApplicationSiteMap and the second time it simply works fine...

What was the problem?... I don't know... I supposed that it was a beginner error... xD...

I will check the "Hands on lab" that you suggest me. Again, thank you vey much...