Geeks With Blogs
Darren Fieldhouse

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!

Posted on Monday, September 14, 2009 8:34 AM | Back to top


Comments on this post: Checking if a user has access to a URL in ASP.NET

# re: Checking if a user has access to a URL in ASP.NET
Requesting Gravatar...
Great tip!
Left by SanjayU on Sep 14, 2009 1:32 PM

Your comment:
 (will show your gravatar)


Copyright © DarrenFieldhouse | Powered by: GeeksWithBlogs.net