SPWeb.AnonymousState 属性
Gets or sets the level of access for anonymous users on the website.
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Property AnonymousState As SPWeb.WebAnonymousState
Get
Set
用法
Dim instance As SPWeb
Dim value As SPWeb.WebAnonymousState
value = instance.AnonymousState
instance.AnonymousState = value
public SPWeb.WebAnonymousState AnonymousState { get; set; }
属性值
类型:Microsoft.SharePoint.SPWeb.WebAnonymousState
An SPWeb.WebAnonymousState value that specifies the level of access. If you set the value to WebAnonymousState.On, the value of the AnonymousPermMask64 property depends on the permission mask for the Limited Access role.
示例
The following code example gives anonymous users access to lists and libraries on the site.
Using webSite As SPWeb = SPContext.Current.Site.OpenWeb("MyWebSite")
webSite.AnonymousState = SPWeb.WebAnonymousState.Enabled
End Using
using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("MyWebSite"))
{
oWebsite.AnonymousState = SPWeb.WebAnonymousState.Enabled;
}
备注
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.