Export (0) Print
Expand All
Expand Minimize

SPWeb.AnonymousState Property

Windows SharePoint Services 3

Gets or sets the level of access for anonymous users on the Web site.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPWeb.WebAnonymousState AnonymousState { get; set; }

Property Value

Type: 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 (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("MyWebSite"))
{
    oWebsite.AnonymousState = SPWeb.WebAnonymousState.Enabled;
}
NoteNote

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 Best Practices: Using Disposable Windows SharePoint Services Objects.

Community Additions

ADD
Show:
© 2014 Microsoft