Hi friends,
While reading, I came through some nice information where we can implement their own way of doing Elevated Priviledege without using RunWithElevatedPriviledege.
Please have a look:
var userAccount = SPContext.Current.Web.AllUsers[@"SHAREPOINT\SYSTEM"];
var userToken = userAccount.UserToken;
using (var site = new SPSite(SPContext.Current.Web.Url, userToken))
{
// This code runs under the security context of the SHAREPOINT\system
using(var elevatedWeb = site.OpenWeb())
{
// Perform actions as SYSTEM
}
}
For more reference : http://msdn.microsoft.com/en-us/library/bb466220%28v=office.12%29.aspx
Many Thanks
Prabhat
While reading, I came through some nice information where we can implement their own way of doing Elevated Priviledege without using RunWithElevatedPriviledege.
Please have a look:
var userAccount = SPContext.Current.Web.AllUsers[@"SHAREPOINT\SYSTEM"];
var userToken = userAccount.UserToken;
using (var site = new SPSite(SPContext.Current.Web.Url, userToken))
{
// This code runs under the security context of the SHAREPOINT\system
using(var elevatedWeb = site.OpenWeb())
{
// Perform actions as SYSTEM
}
}
For more reference : http://msdn.microsoft.com/en-us/library/bb466220%28v=office.12%29.aspx
Many Thanks
Prabhat
No comments:
Post a Comment