摘要:
WSS3 中的 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges 替代 Impersonate 进行权限提升.
好处就是根本不需要在配置文件写些什么用户名密码, 省了麻烦, 加了一定密码泄漏安全, 但是也增加了不安全代码的后门.
RunWithElevatedPrivileges 使用的是你IIS Application的进程池帐户,所以注意安全,嘿嘿.
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// 用系统帐户做操作
});
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{//注意要new一个, 用SPContext.Current.Site的话,那就是当前帐户的安全级别
//用系统帐户操作这个site
}
}) 阅读全文
posted @ 2007-06-14 00:47
shareach
阅读(263)
评论(0)
推荐(0)
浙公网安备 33010602011771号