1
我想知道爲什麼下面列出的兩種方法不提供相同的安全修整。在MOSS發佈站點使用提升權限運行的方法
預期結果:兩種方法給當前網站集
實際結果完全訪問所有內容:安全修整,使用方法1
時出現方法#2適用於從其他網站檢索內容,但方法#1不適用。
兩種方法都可以跨網訪問的匿名模式,併爲站點管理員賬戶裏工作。
的差別來自於層次經理,審批和編輯。方法#1不允許跨網絡管理員訪問。
方法#1
using (SystemOperation op = new SystemOperation())
{
//Do an operation that requires retrieving across webs
}
public class SystemOperation : IDisposable
{
private WindowsImpersonationContext ctx;
public SystemOperation()
{
if (!WindowsIdentity.GetCurrent().IsSystem)
{
ctx = WindowsIdentity.Impersonate(System.IntPtr.Zero);
}
}
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool all)
{
if (ctx != null)
{
ctx.Undo();
}
}
}
方法#2:
Microsoft.Sharepoint.SPSecurity.RunWithElevatedPrivileges(delegate()
{
//Do an operation that requires retrieving across webs
});
問題在哪裏? – Tundey 2009-02-19 17:17:06