Deny access to a directory with web.config

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

  1. #1

    Default 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
    [url]www.domain.com/content/html/nnn[/url]
    or
    [url]www.domain.com/content/images/nnn[/url]
    and injected in the desktopdefault.aspx page.

    How can I prevent users doing [url]www.domain.com/content/images/test.jpg[/url]
    and getting the image (or the html file, or whatever inside the
    content directory?)
    It doesn't matter if the user is authenticated or not, I just want
    obly the webapplication to be able to load and display the files
    inside the /content directory.

    Can I do this just manipulating the web.config, without changing
    directory permissions on the webserver?


    Thanks!
    Matt Guest

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    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 Re: Deny access to a directory with web.config

    You can move the directory outside of the web application's directory.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]


    > Hello,
    > I'm working on a portal based on IBuySpy, where the main page is
    > desktopdefault.aspx and all content is stored in
    > [url]www.domain.com/content/html/nnn[/url]
    > or
    > [url]www.domain.com/content/images/nnn[/url]
    > and injected in the desktopdefault.aspx page.
    > How can I prevent users doing [url]www.domain.com/content/images/test.jpg[/url]
    > and getting the image (or the html file, or whatever inside the
    > content directory?)
    > It doesn't matter if the user is authenticated or not, I just want
    > obly the webapplication to be able to load and display the files
    > inside the /content directory.
    > Can I do this just manipulating the web.config, without changing
    > directory permissions on the webserver?
    >
    > Thanks!
    >


    Brock Allen Guest

  4. #3

    Default Re: Deny access to a directory with web.config

    Good suggestion, but is there a way to control access to that
    directory with the web.config?

    Thanks.
    >You can move the directory outside of the web application's directory.
    >
    >-Brock
    >DevelopMentor
    >[url]http://staff.develop.com/ballen[/url]
    >
    >
    >
    >> Hello,
    >> I'm working on a portal based on IBuySpy, where the main page is
    >> desktopdefault.aspx and all content is stored in
    >> [url]www.domain.com/content/html/nnn[/url]
    >> or
    >> [url]www.domain.com/content/images/nnn[/url]
    >> and injected in the desktopdefault.aspx page.
    >> How can I prevent users doing [url]www.domain.com/content/images/test.jpg[/url]
    >> and getting the image (or the html file, or whatever inside the
    >> content directory?)
    >> It doesn't matter if the user is authenticated or not, I just want
    >> obly the webapplication to be able to load and display the files
    >> inside the /content directory.
    >> Can I do this just manipulating the web.config, without changing
    >> directory permissions on the webserver?
    >>
    >> Thanks!
    >>
    >
    >
    Matt Guest

  5. #4

    Default Re: Deny access to a directory with web.config

    web.config :

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

    <system.web>
    <authorization>
    <allow users="ASPNET's account name"/>
    <deny users="*"/>
    </authorization>

    </system.web>
    </configuration>




    Juan T. Llibre
    ASP.NET MVP
    [url]http://asp.net.do/foros/[/url]
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Matt" <none@none.com> wrote in message news:e2ju61l2vntc345gtvcbc0ukfmdeull60l@4ax.com...
    > Good suggestion, but is there a way to control access to that
    > directory with the web.config?
    >
    > Thanks.
    >
    >>You can move the directory outside of the web application's directory.
    >>
    >>-Brock
    >>DevelopMentor
    >>[url]http://staff.develop.com/ballen[/url]
    >>
    >>
    >>
    >>> Hello,
    >>> I'm working on a portal based on IBuySpy, where the main page is
    >>> desktopdefault.aspx and all content is stored in
    >>> [url]www.domain.com/content/html/nnn[/url]
    >>> or
    >>> [url]www.domain.com/content/images/nnn[/url]
    >>> and injected in the desktopdefault.aspx page.
    >>> How can I prevent users doing [url]www.domain.com/content/images/test.jpg[/url]
    >>> and getting the image (or the html file, or whatever inside the
    >>> content directory?)
    >>> It doesn't matter if the user is authenticated or not, I just want
    >>> obly the webapplication to be able to load and display the files
    >>> inside the /content directory.
    >>> Can I do this just manipulating the web.config, without changing
    >>> directory permissions on the webserver?
    >>>
    >>> Thanks!

    Juan T. Llibre Guest

  6. #5

    Default Re: Deny access to a directory with web.config

    There's a step-by-step tutorial at :

    [url]http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=186[/url]



    Juan T. Llibre
    ASP.NET MVP
    [url]http://asp.net.do/foros/[/url]
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Juan T. Llibre" <nomailreplies@nowhere.com> wrote in message
    news:ejueHIxSFHA.1152@tk2msftngp13.phx.gbl...
    > web.config :
    >
    > <?xml version="1.0" encoding="utf-8" ?>
    > <configuration>
    >
    > <system.web>
    > <authorization>
    > <allow users="ASPNET's account name"/>
    > <deny users="*"/>
    > </authorization>
    >
    > </system.web>
    > </configuration>
    >
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > [url]http://asp.net.do/foros/[/url]
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > "Matt" <none@none.com> wrote in message
    > news:e2ju61l2vntc345gtvcbc0ukfmdeull60l@4ax.com...
    >> Good suggestion, but is there a way to control access to that
    >> directory with the web.config?
    >>
    >> Thanks.
    >>
    >>>You can move the directory outside of the web application's directory.
    >>>
    >>>-Brock
    >>>DevelopMentor
    >>>[url]http://staff.develop.com/ballen[/url]
    >>>
    >>>
    >>>
    >>>> Hello,
    >>>> I'm working on a portal based on IBuySpy, where the main page is
    >>>> desktopdefault.aspx and all content is stored in
    >>>> [url]www.domain.com/content/html/nnn[/url]
    >>>> or
    >>>> [url]www.domain.com/content/images/nnn[/url]
    >>>> and injected in the desktopdefault.aspx page.
    >>>> How can I prevent users doing [url]www.domain.com/content/images/test.jpg[/url]
    >>>> and getting the image (or the html file, or whatever inside the
    >>>> content directory?)
    >>>> It doesn't matter if the user is authenticated or not, I just want
    >>>> obly the webapplication to be able to load and display the files
    >>>> inside the /content directory.
    >>>> Can I do this just manipulating the web.config, without changing
    >>>> directory permissions on the webserver?
    >>>>
    >>>> Thanks!
    >
    >

    Juan T. Llibre Guest

  7. #6

    Default Re: Deny access to a directory with web.config


    I tried, but nothing changes, the user can still do something like
    [url]www.domain.com/content/html/test.htm[/url]
    and see the content.


    On Wed, 27 Apr 2005 06:15:05 -0400, "Juan T. Llibre"
    <nomailreplies@nowhere.com> wrote:
    > <allow users="ASPNET's account name"/>
    > <deny users="*"/>
    Matt Guest

  8. #7

    Default Re: Deny access to a directory with web.config

    Thanks I'll read it

    On Wed, 27 Apr 2005 06:26:18 -0400, "Juan T. Llibre"
    <nomailreplies@nowhere.com> wrote:
    >[url]http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=186[/url]
    Matt Guest

  9. #8

    Default Re: Deny access to a directory with web.config

    > Good suggestion, but is there a way to control access to that
    > directory with the web.config?
    Not if IIS is serving up the files, as the request never makes it to ASP.NET.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]



    Brock Allen Guest

  10. #9

    Default Re: Deny access to a directory with web.config

    I think that adding the specific file types to the files managed
    by ASP.NET will turn the trick if you implement forms-based
    authentication to the directory.



    Juan T. Llibre
    ASP.NET MVP
    [url]http://asp.net.do/foros/[/url]
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
    news:564311632501908156760592@msnews.microsoft.com ...
    >> Good suggestion, but is there a way to control access to that
    >> directory with the web.config?
    >
    > Not if IIS is serving up the files, as the request never makes it to ASP.NET.
    >
    > -Brock
    > DevelopMentor
    > [url]http://staff.develop.com/ballen[/url]
    >
    >
    >

    Juan T. Llibre Guest

  11. #10

    Default Re: Deny access to a directory with web.config

    > I think that adding the specific file types to the files managed by
    > ASP.NET will turn the trick if you implement forms-based
    > authentication to the directory.
    Yep, that will work.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]



    Brock Allen 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