gpt4 book ai didi

powershell - 共享点错误:Enable-SPFeature:此页面的安全验证无效

转载 作者:行者123 更新时间:2023-12-03 00:50:05 25 4
gpt4 key购买 nike

当我尝试通过PowerShell部署项目时, PS 继续进行“Enable-SPFeature” 操作,
然后在下面显示错误消息:

Enable-SPFeature : The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. At E:\Demo\DemoProject\DemoProject\scripts\utility.ps1:315 char:19 + Enable-SPFeature <<<< -identity $id -url $url -confirm:$false + CategoryInfo : InvalidData: (Microsoft.Share...etEnableFeature:SPCmdletEnableFeature) [Enable-SPFeature], SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature



谁能提供解决方案?

最佳答案

每当我们更新任何列表项,列表或SPWeb实例时,您都可能会获得“此页面的安全验证无效。在Web浏览器中单击“上一步”,刷新页面,然后再次尝试操作”。这是因为在更新对内容数据库的修改时进行了一些安全验证,因此,为了避免该异常,我们必须将AllowUnsafeUpdates实例的SPWeb属性设置为true。

SPWeb oWeb = new SPWeb();

oWeb.AllowUnsafeUpdates = true;
AllowUnsafeUpdates属性用于获取或设置一个 bool(boolean) 值,该值指定是否允许由于GET请求而对数据库进行更新,或者是否需要安全验证。 SPSite类也具有此属性。

关于powershell - 共享点错误:Enable-SPFeature:此页面的安全验证无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31471942/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com