对 SharePoint 网站根目录的匿名访问
我已在 SharePoint 网站上为“列表和库”配置了匿名访问。然后,我根据我的要求启用对各个列表/库的匿名访问。
这很好用,但我无法访问根站点 URL,我希望将其重定向到欢迎页面:
如果我将 Web 权限设置为“整个网站”,我可以访问根 URL,但我不想这样做。
我正在使用站点定义配置我的站点,并在功能激活期间通过对象模型修改站点,例如
web.AnonymousPermMask64 = SPBasePermissions.Open;
web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.Update();
...这是我已经成功使用的代码。
有谁知道如何允许匿名访问http://servername?
I have configured anonymous access on a SharePoint site for "Lists and Libraries". I then enable anonymous access to the individual lists/libraries as per my requirements.
This works great, but I cannot access the root site URL where I expect to be redirected to the welcome page:
- Access to http://servername fails with Access Denied
- Access to http://servername/Pages/Default.aspx succeeds
If I set the web permissions to "Entire Web Site", I can access the root URL, but I don't want to do this.
I am provisioning my site with a site definition and modifying the site through the object model during feature activation e.g.
web.AnonymousPermMask64 = SPBasePermissions.Open;
web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.Update();
... this is the code I'm already using with success.
Does anyone know how to allow anonymous access to http://servername?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,您需要在 Web 对象上授予以下权限掩码:
真的很简单!匿名用户现在可以导航到 http://servername 并重定向到欢迎页面。
注意:这两个属性的设置顺序很重要。将 AnonymousState 属性设置为 Enabled,仅将权限掩码设置为 SPBasePermissions.Open。如果您如上所示交换两个属性的顺序,这将删除 SPBasePermissions.ViewPages 标志。
It turns out you need to grant the following permission mask on the web object:
Simple really! Anonymous users can now navigate to http://servername and get redirected to the welcome page.
Note: the order of these two properties being set is important. Setting the AnonymousState property to Enabled, sets the permission mask to SPBasePermissions.Open only. This would remove the SPBasePermissions.ViewPages flag if you switched the order of the two properties as shown above.
您需要在页面库上启用匿名访问,以便您可以访问default.aspx 页面。
You need to enable Anonymous access on the Pages library so that you have access to the default.aspx page.