IIS7: How to block access with a web.config file?

Posted by neves on Server Fault See other posts from Server Fault or by neves
Published on 2009-10-08T19:22:32Z Indexed on 2012/12/04 23:06 UTC
Read the original article Hit count: 251

Filed under:
|
|
|

I know that IIS7 allows me to have a per directory configuration with the web.config xml file. I have a directory with some configuration files that don't want to be web accessible. A local web.config file forbidding read access to it would be a nice solution.

What should be the contents of a web.config file to forbid web access to the files?

Edit: I'm trying to put a web.config file with these contents in a file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
            <system.web>
                    <authorization>
                            <deny users="*" /> <!-- Denies all users -->
                    </authorization>
            </system.web>
</configuration>

But I can still directly access a file inside the directory. What's wrong with it? How do I debug what's happening?

© Server Fault or respective owner

Related posts about iis

Related posts about iis7