CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.security Tags:
Item Type: NewsGroup Date Entered: 10/22/2006 4:46:22 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 9 Views: 38 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
10 Items, 1 Pages 1 |< << Go >> >|
sky_lion
Asp.Net User
Location tag in the Web.Config is not working10/22/2006 4:46:22 AM

0/0

Hello,

my site is running Asp.net 2 on IIS 6 ( via third-party service provider).

I'm trying to secure a couple of folders  in the root directory to be accessed only by the authenticated users. The rest of the site is to be available for everyone. I'm not using Roles, just Membership feature.

To accompish this, I included <location/> tags in my web.config.

But, but, but ...  those directories are still accessible by everyone! Then I tried to place web.config in the sub-directories ( a shortened version as prescribed in the ealeir posts in this forum) ... but it still does not work. 

Any ideas?

 Here is files structure:

root/

root/family_albums/

root/trees/

 

Here is my web.config in the root dir:

<?xml version="1.0"?>

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
...
 <system.web>
 ...
  <authentication mode="Forms">
   <forms name="AuthCookie" loginUrl="Login.aspx" defaultUrl="index.aspx" protection="All" timeout="30" path="/" />
  </authentication>

  <authorization>
    <allow users="*"/>
  </authorization>

 </system.web>

 <!-- deny access to non-members  -->
 <location path="trees">
  <system.web>
   <authorization>
    <deny users="?"/>
   </authorization>
  </system.web>
 </location>
 <location path="family_albums">
  <system.web>
   <authorization>
    <deny users="?"/>
   </authorization>
  </system.web>
 </location>
</configuration>
 

thanks !!!


sky_lion
stiletto
Asp.Net User
Re: Location tag in the Web.Config is not working10/23/2006 8:53:33 PM

0/0

web.config can only secure files that will go through the aspnet worker process.  So, are your files mapped to be handled by the worker process?

sky_lion
Asp.Net User
Re: Location tag in the Web.Config is not working10/24/2006 6:39:39 PM

0/0

 You are correct! My files were pdf and jpg, they were not mapped.

As I found in this discussion group: 

Forms authentication protects ASPX files and other resources owned by ASP.NET, but it does not restrict access to HTML files and other non-ASP.NET resources.

The best way to do it is map *.htm, *.html, and other file name extensions to Aspnet_isapi.dll in the IIS metabase. (You can use the IIS configuration manager to do the mapping.) Transferring ownership of these resources to ASP.NET degrades performance a bit, but it might be worth it for the added security.

thank you very much!

P.S.

Hey, is the grass really blue in the blue grass state?

-:)

thanks again


sky_lion
LudovicoVan
Asp.Net User
Re: Location tag in the Web.Config is not working10/24/2006 6:46:02 PM

0/0

Hello, may I ask whether there is a way to map files to Asp.Net from .Net itself, via web.config or programmatically?

That might be great for sites on basic hosting providers, where you cannot configure IIS.

Thanks. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
stiletto
Asp.Net User
Re: Location tag in the Web.Config is not working10/24/2006 7:24:10 PM

0/0

I've seen real bluegrass, but I can't ever seem to catch it when it's blue...  It's just too happy...
stiletto
Asp.Net User
Re: Location tag in the Web.Config is not working10/24/2006 7:25:43 PM

0/0

You might be able to do it with HttpHandlers in the web.config, but I'd be surprised since IIS has to make the first decision on whether or not to serve the file or pass it to the aspnet worker process.
LudovicoVan
Asp.Net User
Re: Location tag in the Web.Config is not working10/25/2006 3:46:00 PM

0/0

stiletto:
You might be able to do it with HttpHandlers in the web.config, but I'd be surprised since IIS has to make the first decision on whether or not to serve the file or pass it to the aspnet worker process.

Unfortunately, I guess you are right...

Thanks. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
jackmacokc
Asp.Net User
Re: Location tag in the Web.Config is not working10/26/2006 7:44:21 PM

0/0

It seems to me the answer to your problem is very simple - look at your web.config file outside of the location tags:

  <authorization>
    <allow users="*"/>
  </authorization>

 Doesn't it seem that would allow all users to access the site? Try changing that to <deny users="?"/> and see if you get better results.

sky_lion
Asp.Net User
Re: Location tag in the Web.Config is not working - jpg-s are not displayed!10/26/2006 10:43:59 PM

0/0

My host provider has changed the mappings, so jpg, pdf extensions are now mapped to to Aspnet_isapi.dll in the IIS metabase.

The access to the folders is secured and  works fine.

 But, but, but now jpg and pdf files are NOT displayed at all, anywhere on my site.... !!!

What is wrong?

At the same time, everything is OK on my own development PC....

 

 

 


sky_lion
stiletto
Asp.Net User
Re: Location tag in the Web.Config is not working - jpg-s are not displayed!10/27/2006 6:24:47 PM

0/0

What kind of headers are being sent back by IIS when you request a pdf or jpg?
10 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
C#. Net Web Developer's Guide: Web Developer's Guide Authors: Cameron Wakefield, Adrian Turtschi, Saurabh Nandu, Greg Hack, Wei Meng Lee, Joseph Albahari, Jason Werry, Pages: 608, Published: 2002
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006
Build Your Own ASP.NET 2.0 Web Site Using C# & VB: The Ultimate ASP.NET Begginner's Guide Authors: Cristian Darie, Zak Ruvalcaba, Pages: 689, Published: 2006
Pro PHP: Patterns, Frameworks, Testing and More Authors: Kevin McArthur, Pages: 349, Published: 2008
The Definitive Guide to SUSE Linux Enterprise Server Authors: Sander van Vugt, Pages: 683, Published: 2006
Setting Up LAMP: Getting Linux, Apache, MySQL, and PHP Working Together Authors: Eric Rosebrock, Eric Filson, Pages: 391, Published: 2004
Pro ASP.NET 2.0 Website Programming Authors: Damon Armstrong, Pages: 641, Published: 2005
Mastering Web Development with Microsoft Visual Studio 2005 Authors: John Paul Mueller, Pages: 822, Published: 2005

Web:
Web.Config and the location tag not working - ASP.NET Forums Config and the location tag not working. Last post 08-07-2003 11:58 AM by Feline . 6 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
IIS 7.0: Working With Configuration Files in IIS 7.0 IIS 7.0: Working With Configuration Files in IIS 7.0 ... Not applicable. Site's root application Web.config. Use location tags to store site configuration ...
VON# - DasBlog and the Web.Config Location Tag May 18, 2008 ... DasBlog and the Web.Config Location Tag. So you may or may not have noticed that I haven't posted anything for the past two months and that ...
Intellisence not working in web.config? Intellisence not working in web.config?Visual Studio 2005 has an ... Well, I found that removing the namespace from the configuration tag kicks it all back ...
customerror entry in the Web.Config is not working -- Please Help Me!! Talk about customerror entry in the Web.Config is not working ... the customerrors tag in the web.config from "On" to "Off" if you want ...
TheMSsForum.com >> Asp >> web.config authorization element not ... how to route all incoming request to asp.net engine? very anxious to know!!!!! thanks in advance Tag: web.config authorization element not working as ...
DotnetCoders - User Authorization in Sub-Directories To specify authorization settings, add a tag to the web.config file as a child of the root tag. Note that this tag does not go ...
Diablo: Overriding Web.config Using Location Tag May 21, 2007 ... Use the tag in web.config to describe the settings for folders within ... "Visual studio could not identify the version of A.. ...
Visual Studio and parsing in web.config - Rick Strahl's ... Jan 2, 2008 ... Any change that is now made to web.config adds to the bottom of the config file rather than into the specific tag. ...
microsoft.public.dotnet.framework.aspnet.security: RE: Help needed ... web.config file. "Raghu Raman" wrote:. > > > Hi, thanks for that. but i did not get he result for that.it spits the > error for the tag. ...

Videos:
XML11: An Abstract Windowing Protocol Google TechTalks June 1, 2006 Arno Puder Arno Puder received his masters and Ph.D. in computer science and is currently working as an Assistant Prof...
Santa Monica Council Meeting Santa Monica Council Meeting
Using open source tools for performance testing Google London Test Automation Conference (LTAC) Google Tech Talks September 8th, 2006 Presenter: Goranka Bjedov




Search This Site:










best photo album module

two menus from one sitemap?

asp:boundfield

blank user pages - multi-user config

phone number regular expression

skip website validation when rebuild all, is it possible?

converting 2.1.2 skin to 3.1.x

its just showing the script and not running it

all lay load on a willing horse

new 1.0.10e installation - all is fine....except

hiding image urls

importing user login/password through db - how??

sitemap options

pass parameters to sql reporting services through url link

accessing the aspnetdb

edit changes on modules will not stay

is it possible to link to a webpage within a multipage

passing variable from content page to web user control embedded in a master page

stop interior whitespace collapse in editor?

is it possible to set different culture in each page

trouble with asp.net databasing on xp

controldesigner "missing assembly reference"

wrong validators are fired

enter profile of registered user.

problem adopting asp.net web site configuration tool code

xml & css issues

where can i config the asp application in asp.net2.0?

sending html table in a mail

connection with database in hosting server

someone can help, how to configure the database

 
All Times Are GMT