SPSecurity.RunWithElevatedPrivileges 拒绝访问

SPSecurity.RunWithElevatedPrivileges 可以提升权限 实现模拟管理员身份的功能 ,但是SPContext.Current.Site,

SPContext.Current.Web 根据这些方法获得的对象都是以当前登录用户权限运作。

SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite spSiteNew = new SPSite(SPContext.Current.Site.ID))
            {
                using (SPWeb spWebNew = spSiteNew.OpenWeb(SPContext.Current.Web.ID))
                {

        //自己的方法                    

                }
            }
        });

原文地址:https://www.cnblogs.com/cangqiong/p/1875525.html