I spent ages this morning trying to find a way to determine if a user has permission to access a page before navigating to it. I knew it was possible, the SiteMapProvider has a property called “SecurityTrimmingEnabled” that hides pages that the user cannot access.
In the end I found a really useful object called UrlAuthorizationModule in the System.Web.Security namespace that has a method called CheckUrlAccessForPrincipal(). Pass in the url and get a Boolean return value indicating whether the resource is accessible. Easy when you know how!