asp.netiisweb-configdirectory-browsing

Directory browsing stops working in App_Data directory


Question:

In my ASP.NET web solution, I have a directory called redlines.

Into it, I put this web.config, to make the directory browsable.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" />
    </system.webServer>
</configuration>

Now it works fine. But when I move the entire redlines directory into App_Data, wanting to browser the folder redlines, I get HTTP 403.

I copy the same web.config into App_Data, because I thought that might help, but it didn't.

What's the problem ? (IIS development server, Visual Studio 2010)


Solution

  • App_Data is a protected folder, you cannot access it via the url. This is baked into the ASP.NET system, I don't know if you can override it? Its the same if you try to download some other reserved files such as web.config.

    The App_Data folder is designed to store your sensitive data in it. You can use a HttpHandler to serve up files if you want to give files out that live in there.