Authorize a directory for anonymous users IIS 7.5?

I’m trying to add a directory for anon access in IIS 7.5. It works under Web Dev but not IIS 7.5

I’m currently using this web.config in the directory. This is a directory with style sheets:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    WindowsMicrosoft.NetFrameworkv2.xConfig 
-->

    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>
            <authorization>

                <allow users="*" />

            </authorization>

        </system.web>
    </configuration>

Update:

I’ve went to the folder and under Authentication, I’ve changed anonymous authentication from IIS_USR to pool. This seems to have correct it.

I will reward anyone who provides a very good explanation and resources for understanding this setting. Also, how to apply it globally would be good to know — for all folders.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Since you answered your own question, here is the explanation that might help

Authorization deals with who IIS will offer resources to. Those resources, however, have their own security as they are just files on a file system.

The Authentication element in the config assists in determining how IIS will identify a user’s requests after its accepted and as it accesses resources beyond/external to IIS.

This is set at the site level, typically in the applicationHost.config file for your server. It can, if properly setup, be overridden at the site level.

IIS.net pages about this:

http://www.iis.net/ConfigReference/system.webServer/security/authorization/add

http://www.iis.net/ConfigReference/system.webServer/security/authentication/anonymousAuthentication

The .config version of what you did in the UI is:

<location path="/yourSite">
   <system.webServer>
      <security>
         <authentication>
            <anonymousAuthentication enabled="true" username="" />
          </authentication>
      </security>
   </system.webServer>
</location>

On the anon. auth method, the username field is who IIS will impersonate when resources are accessed. When you don’t specify one, it defaults to use the identity of the apppool.

Now, as to why this mattered … check the actual file on disk (the .css). If this fixed the problem that would mean IUSR doesn’t have access to read that file.

Method 2

You don’t have a location defined for your authorization. You also don’t specify what sort of authentication you’re using within the web.config (if any).

<location path="/">
    <system.web>
    <authorization>
        <allow users="*"/>
        </authorization>
    </system.web>
</location>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x