Deny web access to a directory?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Deny web access to a directory?

    Hi,

    I have a asp.net site running on an MS Access database this is, for better
    or worse, stored under the webroot.

    How can I lockout the database directory to prevent anyone from downloading
    it via HTTP?

    I have attached my web.config file at the end of this message.

    The problem is that the "database" directory is still viewable by anyone.
    Not sure why. Do I have a typo?


    Thanks,
    David


    ---------------------------------------------



    <configuration>

    <system.web>
    <customErrors mode="Off"/>

    <!-- Authentication form -->
    <authentication mode="Forms">
    <forms name=".ASPXAUTH" loginUrl="app-admin/Login.aspx" protection="All"
    timeout="999999" path="/app-admin/" />
    </authentication>

    <!-- Allow anon users to main site -->
    <authorization>
    <allow users="?" />
    </authorization>
    </system.web>

    <!-- Set up secure zone for app admin -->
    <location path="app-admin">
    <system.web>

    <!-- disallow anon users-->
    <authorization>
    <deny users="?" />
    </authorization>
    </system.web>
    </location>

    <!-- Set up secure zone for database -->
    <location path="database">
    <system.web>

    <!-- disallow all users-->
    <authorization>
    <deny users="*" />
    </authorization>
    </system.web>
    </location>

    </configuration>

    david Guest

  2. Similar Questions and Discussions

    1. Deny access to a directory with web.config
      Hello, I'm working on a portal based on IBuySpy, where the main page is desktopdefault.aspx and all content is stored in...
    2. How to Deny Access to Certain User?
      I need to know how to deny access to a user (or role, for that matter) in Contribute 3. A client called me and they fired the worker who was in...
    3. Deny access to a folder
      How can I deny access to a folder when authorization mode is none. I have xml files and I don't want then to be seen. When I restrict it from IIS, I...
    4. Deny Access to a page
      I am using forms auth. against a sql db. I am using a role membership to control access to the various pages in the application. I have created a...
    5. how to deny access to certain volume via file sharing (OS9)?
      Hi all - I have a Mac running OS9.2 at work. I connect to it from home by file sharing via TCP/IP. I want to set the permissions such that people...
  3. #2

    Default Deny web access to a directory?

    hi,

    asp.net handles only the requests that are mapped on aspnet_isapi which are asmx, aspx and some more - other extensions are directly handled by IIS without even entering your application

    add another script mapping to IIS for .mdb pointing to exactly the same script handler as .aspx - you could also add a HttpForbiddenHandler to your web/machine.config after that.



    ---
    Dominick Baier - DevelopMentor
    [url]http://www.leastprivilege.com[/url]

    nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.security/<4D921C30-E888-4D1A-871E-A4984D6456B6@microsoft.com>

    Hi,

    I have a asp.net site running on an MS Access database this is, for better
    or worse, stored under the webroot.

    How can I lockout the database directory to prevent anyone from downloading
    it via HTTP?

    I have attached my web.config file at the end of this message.

    The problem is that the "database" directory is still viewable by anyone.
    Not sure why. Do I have a typo?


    Thanks,
    David


    ---------------------------------------------



    <configuration>

    <system.web>
    <customErrors mode="Off"/>

    <!-- Authentication form -->
    <authentication mode="Forms">
    <forms name=".ASPXAUTH" loginUrl="app-admin/Login.aspx" protection="All"
    timeout="999999" path="/app-admin/" />
    </authentication>

    <!-- Allow anon users to main site -->
    <authorization>
    <allow users="?" />
    </authorization>
    </system.web>

    <!-- Set up secure zone for app admin -->
    <location path="app-admin">
    <system.web>

    <!-- disallow anon users-->
    <authorization>
    <deny users="?" />
    </authorization>
    </system.web>
    </location>

    <!-- Set up secure zone for database -->
    <location path="database">
    <system.web>

    <!-- disallow all users-->
    <authorization>
    <deny users="*" />
    </authorization>
    </system.web>
    </location>

    </configuration>


    [microsoft.public.dotnet.framework.aspnet.security]
    Dominick Baier Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139