Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make IIS7 stop serving a folder?

Tags:

iis-7

I know that by defualt IIS won't server App_Data or bin folders content to the public.
How to set one more folder to don't server to public?

like image 858
Amr Elgarhy Avatar asked Oct 27 '10 23:10

Amr Elgarhy


People also ask

How do I disable Windows folder browsing?

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.


1 Answers

The proper way to do that is using this:

<configuration>
   <system.webServer>
       <security>
          <requestFiltering>
               <hiddenSegments>
                   <add segment="My_Directory" />
               </hiddenSegments>
           </requestFiltering>
       </security>
   </system.webServer>
</configuration>

This allows you to still access files located there from the IUSR account, but prevents actual requests for files there from being filled directly.

Note that this will block files in that directory, and any subdirectories, no matter where that directory occurs - even if it, itself, is a sub-directory of something else.

like image 188
Andrew Barber Avatar answered Nov 06 '22 14:11

Andrew Barber