I have problem with my own web part
when I run next code
im.Impersonate();
SPSite spwRoot = new SPSite(PortalRootUrl).OpenWeb().Site;
foreach (SPWeb web in spwRoot.AllWebs)
{
//some code
}
it fail with next exception
Exception System.UnauthorizedAccessException: Access is denied. (Exception
from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception
ex)
at
Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)
at Microsoft.SharePoint.Library.SPRequest.GetAllWebsOfSite(String
bstrUrl, Object& pvarWebs, Object& pvarWebIds, Object& pvarParentWebs,
Object& pvarLangs, Object& pvarTitles)
at
Microsoft.SharePoint.SPSite.SPWebCollectionProvider.GetWebsData(String[]&
strNames, String[]& strServiceRelUrls, Guid[]& guidWebIds, Int32[]&
nLanguages, String[]& strTitles, String[]& strDescriptions, String[]&
strCreationTimes, String[]& strModifiedTimes, Boolean[]& bUserIsWebAdmins,
Int32[]& nWebTemplates, Int16[]& nProvisionConfigs, Int16[]& nMeetingCounts)
at Microsoft.SharePoint.SPWebCollection.EnsureWebsData()
at Microsoft.SharePoint.SPWebCollection.Undirty()
at
Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnumerator()
impersonated user have domain admin and local admin rights.
how I can solve this problem?
I found people with same problem http://forums.asp.net/thread/1487916.aspx
but there no ansvers...