Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SharePoint安全编程问题_C#_Security_Sharepoint_Sharepoint 2007 - Fatal编程技术网

C# SharePoint安全编程问题

C# SharePoint安全编程问题,c#,security,sharepoint,sharepoint-2007,C#,Security,Sharepoint,Sharepoint 2007,我正在将SharePoint Server 2007 Enterprise与Windows Server 2008 Enterprise一起使用。我已经部署了一个发布门户。我正在使用VSTS 2008+C++.Net 3.5+ASP.Net+SharePoint Server 2007 SDK开发一个ASP.Net web应用程序 我发现有时我们需要使用SPWebApplication.FormDigestSettings.Enabled=false来漫游,例如使用SharePoint API在

我正在将SharePoint Server 2007 Enterprise与Windows Server 2008 Enterprise一起使用。我已经部署了一个发布门户。我正在使用VSTS 2008+C++.Net 3.5+ASP.Net+SharePoint Server 2007 SDK开发一个ASP.Net web应用程序

我发现有时我们需要使用SPWebApplication.FormDigestSettings.Enabled=false来漫游,例如使用SharePoint API在网站集中创建网站。我想知道为什么我们需要执行SPWebApplication.FormDigestSettings.Enabled=false?背后的原因是什么

提前感谢,,
George

执行命令的用户是否具有运行命令的权限?基于,当您将该属性设置为false时,似乎正在禁用安全验证

获取“超级用户”权限以执行当前用户没有权限运行的命令的更好方法是使用
SPSecurity.RunWithElevatedPrivileges

SPSecurity.RunWithElevatedPrivileges(delegate() 
{
    // Note: It's important that you create all new SPSite and SPWeb
    // objects in the elevated context in order to actually use elevated
    // privileges. Failure to do so will cause your code to execute
    // without elevated privileges.
    using(SPSite site = new SPSite(SPContext.Current.Site.ID))
    {
        using(SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
        {
             // run code here that requires elevated privileges.
        }
    }
});

因此,1。SPWebApplication.FormDigestSettings.Enabled是否用于禁用用户权限检查?2.使用模拟可以达到同样的目的吗?3.最终用户正在从web访问,而IIS正在使用工作进程的用户标识帐户执行,我想知道是否使用SPWebApplication.FormDigestSettings.Enabled=true检查用户权限,SharePoint是否根据IIS工作进程标识或某些其他标识检查权限?1。看来是这样的,对。2.使用此模拟方法会导致代码作为“系统帐户”运行,并具有与之关联的所有权限。此帐户通常是在IIS中配置的服务帐户。3.Sharepoint使用当前登录用户的身份来执行代码,如果当前用户没有权限,则您会收到拒绝访问错误。因此,对于3,这意味着如果用户是Sharepoint web应用程序管理员,有权创建子网站,则无需使用您提供的代码块?对于一个普通用户,我们需要这样的代码?有一种更好、更稳定的方法可以使用这里提到的系统权限执行命令:更稳定,因为它不会交换线程标识。我在某些地方遇到了RunWithElevatedPrivileges的问题,仅使用SPSite构造函数,提供系统帐户用户令牌,就解决了这个问题。原因如下: