Gets or sets the level of access for anonymous users on the website.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration Public Property AnonymousState As SPWeb.WebAnonymousState Get Set 'Usage Dim instance As SPWeb Dim value As SPWeb.WebAnonymousState value = instance.AnonymousState instance.AnonymousState = value
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
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.