SharePoint 2010 Check User Permission on Web

In this article I would like to explore multiple ways to check User Permissions on a web object.


We need to check whether a particular user has open permission on a web object.


We can use the web.DoesUserHavePermissions() method for this purpose.


The method has 2 overloads, but we are using the second one that takes login as argument. The second argument SPBasePermissions can be used to specify the type of permission.



For testing purposes create a console application, add a reference to SharePoint DLLs & change the following project properties:

  1. Target Framework to .Net 3.5
  2. Platform Target to Any CPU

Place the following code in the main method:

using (SPSite site = new SPSite("http://localhost"))


    using (SPWeb web = site.OpenWeb())


        bool result = web.DoesUserHavePermissions("DOM\USR", SPBasePermissions.Open);







Please use the appropriate user names in the code.


For the preceding site, assign a user with Read Permission. Execute code & you will get the result TRUE.

Now, remove the user from all permissions, including Authenticated users. You will get the result FALSE.

Note: Although the preceding method was invoked using SPWeb object, we can invoke it from SPList and SPItem as well. In general the method is available for all SPSecurableObject types.

  1. SPWeb inherits from SPSecurableObject

  2. SPList inherits from SPSecurableObject

  3. SPListItem inherits from SPSecurableObject



In this article we have explored how to check User Permissions on a particular web object. In real-world scenarios we need the method for scenarios like custom branding, custom events etcetera.

Up Next
    Ebook Download
    View all
    View all