Tip : SPSecurity.RunWithElevatedPrivileges

While using SPSecurity.RunWithElevatedPrivileges in your code, Always remember to create your own Spweb/Spsite objects and to never use an object created outside the RunWithElevatedPrivileges scope.


SPSecurity
.RunWithElevatedPrivileges(delegate()
{
using (SPWeb web = SPControl.GetContextWeb(Context))
{
//Your Code
}
});

* Advantage of using (SPWeb web ... : Free some Memory!

0 comments: