对 SharePoint 网站根目录的匿名访问

发布于 2024-08-02 13:46:27 字数 715 浏览 4 评论 0原文

我已在 SharePoint 网站上为“列表和库”配置了匿名访问。然后,我根据我的要求启用对各个列表/库的匿名访问。

这很好用,但我无法访问根站点 URL,我希望将其重定向到欢迎页面:

  1. 访问 http://servername 失败,访问被拒绝
  2. 访问 http://servername/Pages/Default.aspx 成功

如果我将 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:

  1. Access to http://servername fails with Access Denied
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小镇女孩 2024-08-09 13:46:27

事实证明,您需要在 Web 对象上授予以下权限掩码:

web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.AnonymousPermMask64 = SPBasePermissions.Open | SPBasePermissions.ViewPages;    
web.Update();

真的很简单!匿名用户现在可以导航到 http://servername 并重定向到欢迎页面。

注意:这两个属性的设置顺序很重要。将 AnonymousState 属性设置为 Enabled,仅将权限掩码设置为 SPBasePermissions.Open。如果您如上所示交换两个属性的顺序,这将删除 SPBasePermissions.ViewPages 标志。

It turns out you need to grant the following permission mask on the web object:

web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.AnonymousPermMask64 = SPBasePermissions.Open | SPBasePermissions.ViewPages;    
web.Update();

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.

一曲琵琶半遮面シ 2024-08-09 13:46:27

您需要在页面库上启用匿名访问,以便您可以访问default.aspx 页面。

You need to enable Anonymous access on the Pages library so that you have access to the default.aspx page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文