Configuring anonymous access for web applications

Allowing anonymous access to SharePoint content is configured in two parts, at the web application level and at the content level. In this recipe, we will enable anonymous access to our SharePoint web application.

How to do it…

Follow these steps to configure anonymous access at the web application level:

  1. Navigate to Central Administration in your preferred web browser.
  2. Click on Manage web applications in the Application Management section as shown in the following screenshot:
    How to do it…
  3. Select the web application that we are enabling anonymous access for.
  4. Click on Authentication Providers in the WEB APPLICATIONS tab on the ribbon as shown in the following screenshot:
    How to do it…
  5. Click on the Default zone.
    How to do it…
  6. Select Enable anonymous access as shown in the following screenshot:
    How to do it…
  7. Click on Save.

How it works...

Authentication for SharePoint is handled at the web application level. A SharePoint web application represents a site in Internet Information Services (IIS). Authentication configuration for the SharePoint web application configures the IIS site accordingly to allow anonymous, unauthenticated users to access the web application.

There's more…

Configuring anonymous access at the SharePoint web application level can also be accomplished with PowerShell or code using the server-side object model.

Configuring anonymous access for web applications using PowerShell

Follow these steps to configure anonymous access for a web application using PowerShell:

  1. Get the SharePoint web application with the following Get-SPWebApplication Cmdlet:
    $webApp = Get-SPWebApplication http://sharepoint
    
  2. Set the AllowAnonymous property for the IIS settings of the Default zone to true:
    $webApp.IisSettings[[Microsoft.SharePoint.Administration.SPUrlZone]::Default].AllowAnonymous = $true
    
  3. Update the web application using the following command:
    $webApp.Update()
    

Configuring anonymous access for web applications with code using the server-side object model

Follow these steps to configure anonymous access for a web application with code using the server-side object model:

  1. Get the SharePoint web application by its URL:
    var webApp = SPWebApplication.Lookup(new Uri("http://sharepoint"));
  2. Set the AllowAnonymous property for the IIS settings of the Default zone to true:
    webApp.IisSettings[SPUrlZone.Default].AllowAnonymous = true;
  3. Update the web application using the following line of code:
    webApp.Update();

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.211.106