Set Anonymous Authentication for specific objects under IIS element

ImportantThe following article uses options that are available starting with the Professional edition and project type.

Sometimes, the authentication method is different for the website and for particular resources under the IIS element. For example, for the site the Windows Authentication is used, while under the website directory there is a folder (e.g. /images ) and the ViewDocument.aspx file that needs to have Anonymous Authentication enabled on them.

NoteTo set the authentication method for the IIS elements you can use the predefined website authentication and application pool identity views.

To set the Anonymous Authentication method for particular resources under an IIS element, you can use a custom action to call the appcmd.exe. The launch file predefined custom action can be used to lauch the appcmd.exe.

For example, the following command line can be passed to the appcmd.exe:

set config "[WEBSITE_NAME]/images" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"True" /commit:apphost      

The custom actions should be executed after the resources are coppied on the local machine, so the After the system has been successfully modified (commit) option for the Execution Time should be selected.

Since the custom action requires administrative privileges, the Run under the LocalSystem account with full privileges (no impersonation) option from the Execution Options section sould be enabled.

For details, check the Anonymous Authentication article with related information for hints and guidance.