I discovered a problem while I was testing my webparts this morning. In my project I have an Admin Site and a user site. The user site is supposed to only be shown by users. It contains a webpart menu with dropboxes with information from the admin site lists.

The webpart and lists are fully working when I'm logged on any administrators. But when I log on my members who can't see the Admin Site the dropdownbox items are not showed.

I've tried to change permissions for the members of the membersite. I gave them the Limited Access level on the Admin Site so they couldn't see the site but it didn't worked. I also tried to stop inherit from the lists in the lists on the Admin Site and gave the members group limited access permissions on the lists. That did not solved my problem either.

Is there any better ways to solve this kind of problems? Codeway maybe? I need to read from the Admin Site to users without the Admin site is showed.

I'm also using list-definitions to make my custom lists on the admin site. Is there maybe some kind of permission I need to add into that code?

Thankful for all your help!

Best regards, Blenni

1 Answer 1


you can try to impersonate system user when get information from lists and use this user when open a site. To impersonate user do following:

SPUserToken sysToken = null;
   using (SPSite site = new SPSite(SPContext.Current.Site.ID))
      sysToken = site.SystemAccount.UserToken;

Once you have your system user account you can open site using this user.

if (sysToken == null)
   SPUtility.TransferToErrorPage("Cannot evaluate user");

using (SPSite site = new SPSite(SPContext.Current.Site.ID, sysToken))
   // Get your drop down items here

Be sure to pass a good site URL when open site.

When site is opened in this way you will be logged as System account while site object exists. Once using is finished object is released and you stay on the page as anonymous.

Hope it helps,


  • I will try put this code in my webpart and see how it goes. But there must be another way through sharepoint?
    – Blenni
    Apr 3, 2013 at 12:10
  • There is a problem with the code. I'm using a save button that saves the choosed values and the current sp user into a list. If I will be on the page as anonymous my webpart won't work.
    – Blenni
    Apr 3, 2013 at 12:21
  • Do your save inside a using or impersonate user again when do your save Apr 3, 2013 at 12:25
  • Nice, glad it helped you ;) Apr 3, 2013 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.