I know this topic has been discussed before, but I'm not able to find a similar problem and solution. We've been struggling with this problem for a while, and now we need some help from the experts :)
What am I trying to do?
I have 2 web applications in Sharepoint 2010RTM. I want to create a Site collection in one webapp from the other.
using (SPSite elevatedSite = new SPSite("webAppUrl"))
SPWebApplication elevatedWebapp = elevatedSite.WebApplication;
using (SPSite site = elevatedWebapp.Sites.Add(..)
The code is running in SPSecurity.RunWithElevatedPrivileges(delegate() and when the elevatedSite-object is created, currentUser = Sharepoint\System. (the logged in user is
ordinaryUser@email.com, so the elevated context seems to be correct).
I get access denied, you are currently signed in as
ordinaryUser@email.com on the line elevatedWebapp.Sites.add(),even if the user is running as System account. The user is logged on using claims based authentication. When running it in windows auth-mode everything works fine. I've checked the
appPool account which is the same as the Admin user set in Web Application user policy. (adminUser\Administrator). However, I've noticed that the property IsSiteAdmin = false on the System account running in elevated context. Previous
View Complete Post