Privilege Elevation Exception

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



Answer this question

Privilege Elevation Exception

  • Falklian

    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


  • Privilege Elevation Exception