Disable Directory Listing in IIS

前端 未结 2 1652
庸人自扰
庸人自扰 2020-12-14 22:17

In my web application all the .aspx pages resides in Pages directory. The project structure is shown below:

\"en

相关标签:
2条回答
  • 2020-12-14 22:44

    You need to disable directory browsing from IIS or from the web.config

    <configuration>
      <location path="Secured">
        <system.webServer>
          <directoryBrowse enabled="false" />
        </system.webServer>
      </location>
    </configuration>
    

    this entry above applies to IIS 7+, for IIS 6 you'll have to do it from IIS Manager

    0 讨论(0)
  • 2020-12-14 22:49

    There are 2 ways using which you can disable the Directory Listing: This has been tested & works for IIS 10.

    1. Web.config

    <configuration>
       <system.webServer>
           <directoryBrowse enabled="false" /> <!--this line will disable directory browsing-->
       </system.webServer>
    </configuration>
    

    2. IIS

    Go to Internet Information Services(IIS) and look for the Directory Browser option. Select it and on the right corner you see an option Open Feature. Click on it and it will take you to another tab. Now select Disable and you see that the browsing has been disabled.

    0 讨论(0)
提交回复
热议问题