1

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!

2
$authprov = Get-SPAuthenticationProvider -WebApplication [web application URL] -Zone [zone]
# Check the AllowAnonymous property:
$authprov.AllowAnonymous 

Should return true or false

http://myspworld.wordpress.com/2012/05/31/anonymous-claims-authentication/

|improve this answer|||||
  • Thanks for the reply. Though I should have specified in my original post that I was looking for how to do this in c#, but I appreciate your answer. – athom Oct 25 '12 at 15:22
0

I should have specified in my post, but I was looking for how to do this in C#. I got the answer I was looking for in this link. Here's the code I basically wound up using by utilizing the IisSettings property of the SPWebApplication object:

Dictionary<SPUrlZone, SPIisSettings> settings = webApplication.IisSettings;

foreach (KeyValuePair<SPUrlZone, SPIisSettings> setting in settings)
{
    bool allowAnon = setting.Value.AllowAnonymous;

    //TODO handle stuff with this info
}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.