public class ben:harrell

July 27, 2006

Usability and ASP.NET Site Navigation

Filed under: .NET, Design, Uncategorized, Usability — benjamin harrell @ 6:50 pm

I recently started looking into ASP.NET Site Navigation and the sitemap controls.  Orginally, discounted the sitemap control as something you would drop on a page called sitemap and never touch again but boy was I wrong.  Site Navigation is an entire API for controlling site naviation in a consitent and near drag and drop manner.  And as usual, the 2.0 team hit another home run witht he Provider model allowing you to drive your Sitemap data from any source (XML out of the box but there are already multiple SQL implementations but my favorite is Jeff Prosise’s found here for MSDN magazine).  So what does this have to do with Usability?  Well, today I noticed something very related to Usability in the real world and it immediately hit me that we as developers make the same mistake all the time.  What cardinal Usability sin am I talking about?  Don’t put it there if I am not supposed to use it! I noticed an irate man yanking on a fancy, obvious door ‘pull bar’ and in small print next to it was printed ‘Push’.  Sure it makes for a great joke and even a classic Far Side but this really is a design/usability error!  Why wasn’t there a flat panel that said ‘Push’ on it?  Why the pull bar!!!  Ok so what does this have to do with Site Navigation….well, only the coolest feature in my opinion:

 ASP.NET 2.0’s site navigation provides a feature called security trimming. When obtaining site map information with security trimming enabled, only those site map nodes that the currently logged on user has authorization to visit are available. That means the site’s TreeView or Menu will contain just those sections accessible by the currently logged in user.

I pulled this from a great series on Site Navigation here

Really all you have to do is turn on SecurityTrimming in the web.config as shown below:

 <siteMap defaultProvider=”XmlSiteMapProvider” enabled=”true”>
   <providers>    
     <add name=”XmlSiteMapProvider”      
       description=”Default SiteMap provider.”  
       type=”System.Web.XmlSiteMapProvider”  
       siteMapFile=”siteMapFileName”      
       securityTrimmingEnabled=”true” />  
   </providers>
</siteMap>

That’s it!  Of course you have the ability to override for certain items but I’ll leave that as an exercise to the reader.  Now all we need is a good visual studio Add-In to generate a sitemap file or SQL database script from my current website project…I guess I better get that project started!

Blog at WordPress.com.