Hello.
I`m doing some web.config modifications with SPWebConfigModification class. When adding them to WebApplication and calling Update to it, it throws me SecurityException, although
- I run code with elevated privilages (and open new instance of SPSite)
- my assembly is in GAC
- application pool account is from *wss_admin_wpg* group and web.config file has *wss_admin_wpg* write permissins.
Code
SPSecurity.RunWithElevatedPrivileges(delegate()
{
addProviderProxy(properties);
});
where addProviderProxy(SPItemEventProperties properties)
using (SPSite site = new SPSite(properties.SiteId))
using (SPWeb web = site.OpenWeb())
{
ensureSectionGroup(web);
...
}
where ensureSectionGroup(SPWeb web)
SPWebApplication webApp = web.Site.WebApplication;
...
webApp.Update(); <--Throws exception here
Exception Details
System.Security.SecurityException was caught
Message="Piekļuve liegta." //(Translates to something like "Access Denied")
Source="Microsoft.SharePoint"
StackTrace:
at Microsoft.SharePoint.Administration.SPPersistedObject.Update()
at Microsoft.SharePoint.Administration.SPWebApplication.Update()
at Balticovo.SharePoint.AdjustWebConfigForOutlook.ensureSectionGroup(SPWeb web)
InnerException: