2

In Central Administration\Manage Web Applications, there is the ability to enable anonymous access on a web application through the authentication providers. Is there a way to programmatically determine if this option is enabled? Thanks!

athom
  • 1,257
  • 4
  • 13
  • 30

2 Answers2

3

This should work for you:

web.Site.WebApplication.IisSettings[Microsoft.SharePoint.Administration.SPUrlZone.Internet].AllowAnonymous

I started with web, but you can start wherever you need obviously. Also make sure you look at the appropriate zone.

Jaime Torres
  • 10,365
  • 1
  • 48
  • 56
1

The SPWeb object expose the following boolean :

AllowAnonymousAccess

example :

web.AllowAnonymousAccess;

MSDN : Gets a Boolean value that indicates whether anonymous access is allowed for the website

Le_Fredo
  • 639
  • 3
  • 5