tags:

views:

36

answers:

3

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?

+1  A: 

Remove IIS_IUSR permissions from that folder.

I think its generically under the "Internet Guest Account"

castis
If you do that, you may also be blocking any ability to access those files via the web application at all, which is probably not what is intended.
Andrew Barber
I Removing the IIS_IUSR will work in my case, I want to save there users uploads, now I am saving them on somewhere out side the website folder on the c: drive, and this uploads folder does not have IIS_IUSR permission and I still can access it from my website code.
Amr ElGarhy
+1  A: 

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.

Andrew Barber