Privilege Elevation Exception  
Author Message
Manuk





PostPosted: SharePoint - Development and Programming, Privilege Elevation Exception Top

Hi

I'm writing some code where the user should be system account.....like changing the user information list.

but this code has to run for each user ...for that I searched the internet and cud find below solution

SPSecurity.RunWithElevatedPrivileges(delegate()

{

using (SPSite site = new SPSite(SPContext.Current.Site.ID))

{

using (SPWeb web2 = site.OpenWeb())

{

//mycode

}}});

but his code throws me this exception

Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

Anyone has got some idea to handle this

My trust level is Medium

Thanks

Manu



SharePoint Products and Technologies5  
 
 
Manuk





PostPosted: SharePoint - Development and Programming, Privilege Elevation Exception Top

One solution this problem I found myself is make the trust level of the site as "Full"

does anybody has any other solution

Thanks

Manu