How to allow anonymous user access files in App_Themes folder?

GTEK IT DEV Team asked on May 4, 2018 05:40

My problem is when i logged in, the image file in App_Themes/MyTheme is loaded normaly. But when i signed out and access the front end page, all the font files and images in that folder cannot loaded. How can i resolve this proplem?

I put this in my web.config file. But it not work.

<location path="App_Themes/MyTheme">
    <system.webServer>
      <security>
        <authentication>
          <anonymousAuthentication enabled="true"/>
        </authentication>
      </security>
    </system.webServer>
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

Many thanks !

Recent Answers


Brenden Kehren answered on May 4, 2018 06:08

By default it is already granted as long as the user running the website's app pool has read access to that directory. So add IIS_Usrs to the root of the physical directory and give the user read permissions. Do this in the file system.

Then remove the web config change you made.

1 votesVote for this answer Mark as a Correct answer

GTEK IT DEV Team answered on May 4, 2018 06:28

I added IIS_IUSRS but it still nothing change.

Image Text

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on May 4, 2018 09:55

Perhaps you're using a different application identity. Check this documentation about disk permission.

It tell's you where to find the "Identity" your application uses.


What error do you get when you directly enter the complete path in your browser? is it a file not found or a security warning?

You could also try moving just 1 file to a different location (e.g. the root of the site), just to check if it is available.

1 votesVote for this answer Mark as a Correct answer

GTEK IT DEV Team answered on May 4, 2018 10:17 (last edited on May 4, 2018 10:19)

Hi David te Kloese,

You said right, i used administrator identity for my application pool. I changed the identity to Local Service and set permission on disk for LOCAL SERVICE user. But the error still not resolve.

And when i enter the complete path in my browser, it redirect me to the CMSPages/logon.aspx page. And i tried in another location. The error is the same.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on May 4, 2018 10:34

Have you set any security permission for the root of your site?

something like:

Image Text

And did you remove all your custom security and authentication tag additions to the web.config.

0 votesVote for this answer Mark as a Correct answer

GTEK IT DEV Team answered on May 4, 2018 11:03 (last edited on May 4, 2018 11:19)

There is not any security setting in my root node

Image Text

And web.config does not have any authentication tag except this tag

<authentication mode="Forms">
  <forms loginUrl="CMSPages/logon.aspx" defaultUrl="home-page" name=".ASPXFORMSAUTH" timeout="60000" slidingExpiration="true" />
</authentication>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.