Patrick.O.Ige

Knowledge Creation is Essential to Business, and Communication is Essential to Knowledge Creation

  Home  |   Contact  |   Syndication    |   Login
  94 Posts | 5 Stories | 342 Comments | 0 Trackbacks

News

SharePoint SharePoint SharePoint

Article Categories

Archives

Post Categories

ADO.NET

Ajax

API/WebServices

ASP.NET Resources

BizTalk Server

Blogs I read

Free Books

How to

JQuery

LINQ

Misc

Mobile BI

Reporting Services

SEO

Sharepoint Resources/Tools

SharePoint 2010 Branding

SharePoint 2010 Videos

SilverLight

SQL Server

Sql Server 2012

SSIS

Windows Phone

WorkFlows

WSS V3

xml

With the new Navigation controls in ASP.NET 2.0 you can easily setup security trimming with any provider you choose to use and a web.sitemap file or any other datasource you posses that can give you a menu structure.

I would provide a link to a sample on the net by Scott Gu the ASP.NET guru.
The samples include using both sql server and Windows Authentication


But when setting up this nice and easy handy stuff there are some issues :

1)You will not see your menu listed (nothing will appear)when your root Url is empty like below
<siteMapNode  title="Home">
You will need to have a url node like so :
<siteMapNode url="default.aspx" title="Home">

<location path="Admin">

<system.web>authorization>

<allow roles="IT,Managers"/>

<deny users="*"/>

<authorization>

<system.web>

</location>

This is what the provider will use to determine the authorization of each folders or files listed in your project
The above means only the roles IT and Managers would have access to the Admin folders you can also have a page set in there.


Although if you have the roles set below for the somepage.aspx like below

<siteMapNode url="somepage.aspx" title="Employee" roles="IT,Managers,Support />

If someone in a Support role logs in he would be able to see the somepage.aspx but when he/she clicks on it and try to login he would be denied access based on the authorization tag you declared above.

So you will notice that the security trimming is definitely done on the sitemapNode and the Url and if a user doesn't belong to a specific role not specified you won't see the link.

 Hope this helps and happy coding

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Thursday, January 10, 2008 6:31 PM

Feedback

# re: Enabling securityTrimming with Windows authentification 3/30/2008 9:03 AM Phil Short
Thanks, I had enabled securitytrimming and wondered why my menu has dissappeared. I had a blank top level node. Simple fix - remove the "root" node and make its first child node the root instead. Mines a horizontal menu with 2 static levels so I get the horizontal menu I want anyway!

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: