Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Deny access to a directory with web.config

Reply
Thread Tools

Deny access to a directory with web.config

 
 
Matt
Guest
Posts: n/a
 
      04-26-2005
Hello,
I'm working on a portal based on IBuySpy, where the main page is
desktopdefault.aspx and all content is stored in
www.domain.com/content/html/nnn
or
www.domain.com/content/images/nnn
and injected in the desktopdefault.aspx page.

How can I prevent users doing www.domain.com/content/images/test.jpg
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!
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-26-2005
You can move the directory outside of the web application's directory.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hello,
> I'm working on a portal based on IBuySpy, where the main page is
> desktopdefault.aspx and all content is stored in
> www.domain.com/content/html/nnn
> or
> www.domain.com/content/images/nnn
> and injected in the desktopdefault.aspx page.
> How can I prevent users doing www.domain.com/content/images/test.jpg
> 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!
>




 
Reply With Quote
 
 
 
 
Matt
Guest
Posts: n/a
 
      04-27-2005
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
>http://staff.develop.com/ballen
>
>
>
>> Hello,
>> I'm working on a portal based on IBuySpy, where the main page is
>> desktopdefault.aspx and all content is stored in
>> www.domain.com/content/html/nnn
>> or
>> www.domain.com/content/images/nnn
>> and injected in the desktopdefault.aspx page.
>> How can I prevent users doing www.domain.com/content/images/test.jpg
>> 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!
>>

>
>


 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-27-2005
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
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
======================

"Matt" <> wrote in message news:...
> 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
>>http://staff.develop.com/ballen
>>
>>
>>
>>> Hello,
>>> I'm working on a portal based on IBuySpy, where the main page is
>>> desktopdefault.aspx and all content is stored in
>>> www.domain.com/content/html/nnn
>>> or
>>> www.domain.com/content/images/nnn
>>> and injected in the desktopdefault.aspx page.
>>> How can I prevent users doing www.domain.com/content/images/test.jpg
>>> 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!



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-27-2005
There's a step-by-step tutorial at :

http://www.dotnetcoders.com/web/Arti...px?article=186



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

"Juan T. Llibre" <> wrote in message
news:...
> 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
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaņol
> Ven, y hablemos de ASP.NET...
> ======================
>
> "Matt" <> wrote in message
> news:...
>> 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
>>>http://staff.develop.com/ballen
>>>
>>>
>>>
>>>> Hello,
>>>> I'm working on a portal based on IBuySpy, where the main page is
>>>> desktopdefault.aspx and all content is stored in
>>>> www.domain.com/content/html/nnn
>>>> or
>>>> www.domain.com/content/images/nnn
>>>> and injected in the desktopdefault.aspx page.
>>>> How can I prevent users doing www.domain.com/content/images/test.jpg
>>>> 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!

>
>



 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      04-27-2005

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


On Wed, 27 Apr 2005 06:15:05 -0400, "Juan T. Llibre"
<> wrote:

> <allow users="ASPNET's account name"/>
> <deny users="*"/>


 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      04-27-2005
Thanks I'll read it

On Wed, 27 Apr 2005 06:26:18 -0400, "Juan T. Llibre"
<> wrote:

>http://www.dotnetcoders.com/web/Arti...px?article=186


 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      04-27-2005
> 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
http://staff.develop.com/ballen



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-27-2005
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
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
======================

"Brock Allen" <> wrote in message
news: ...
>> 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
> http://staff.develop.com/ballen
>
>
>



 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      04-27-2005
> 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
http://staff.develop.com/ballen



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie: allow deny vs deny allow Jeff ASP .Net 2 09-19-2006 02:12 AM
Deny access to a directory with web.config Matt ASP .Net 9 04-27-2005 05:21 PM
Deny web access to a directory? Dominick Baier ASP .Net Security 0 09-29-2004 06:50 AM
Deny all web access to a directory? (Searched the net already...) =?Utf-8?B?ZGF2aWQ=?= ASP .Net 3 09-29-2004 04:15 AM
Deny web access to a directory? david ASP .Net Security 0 09-29-2004 01:35 AM



Advertisments