0

I have an ASP.NET Core website which contains the binaries and resources needed to run the website. The site generates log output in a "Log" directory, located inside the web site's root directory.

I would like to be able to browse the contents of this "Log" directory, without allowing browsing of any other directories belonging to the website.

Is there any way to achieve this in IIS or will I need to convert the "Log" directory to a separate application in order to allow directory browsing in that directory?

1 Answer 1

1

Restricting Directory Browsing in IIS

You can restrict directory browsing in IIS by setting the appropriate directory browsing options in the IIS Manager. Here's how you can do it:

  1. Open IIS Manager
  2. Select your ASP.NET Core website
  3. Click on "Features View"
  4. Double click on "Directory Browsing" under the "IIS" section
  5. On the "Directory Browsing" page, select "Log" directory
  6. In the "Actions" pane, click on "Enable" under the "Directory Browsing" option
  7. You can also specify custom options such as the format of the directory listing, etc.

This will allow directory browsing for the "Log" directory and restrict it for other directories.

Alternatively, you can create a separate application in IIS for the "Log" directory and set the directory browsing options for that application.

1
  • 1
    Adding browsing permissions to the Log directory will create a web.config file in that directory, which is then visible when browsing the directory. Is there any way to hide this generated web.config file from the directory when browsing to it?
    – Mort
    Feb 8, 2023 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .