Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2004, 10:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default



http://p2p.wrox.com/topic.asp?TOPIC_ID=8699

I found it :)

 
Old January 21st, 2004, 11:03 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

So apparently I hadn't tried everyone's suggestions hard enough. I just tried and succeeded with a working solution that several people had pointed out. Not sure why I wasn't able to get it before.

It seems that you can only specify the login page details of forms authentication in the root web.config. However, it would seem to make sense that even with forms auth set up, you could still allow the root of the application to allow all anonymous users and restrict subdirectories (with supplemental web.config files) or individual files (with the <location> nodes in the web.config(s)).

I was looking at the comments in the default web.config and began thinking about something. The comment says "Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated) users".

So wouldn't that imply that this:

    <allow users="?" />

would allow anonymous but deny authenticated users? That's the way I interpret it. But it doesn't perform that way. I guess the concept of an "anonymous" user is kind of loose.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 22nd, 2004, 02:42 AM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need to secure a section of it: MyWebApp/privateSection.
Don't put the location to be denied in the system.web part, but after it. Each page must be specified in a location path to be denied. (I don't know if you can deny a whole sub-directory in one statement.

<system.web>

        <authentication mode="Forms">
            <forms name="MyWebApp" loginUrl="Login.aspx" protection="All" path="/" />
        </authentication>
</system.web>

 <location path="privateSection.aspx">
        <system.web>
            <authorization>
                <deny users="?" />
            </authorization>
        </system.web>
 </location>
</configuration>

HtH


Sandra MacGregor
 
Old January 22nd, 2004, 09:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Quote:
quote:Originally posted by shmacgregor
  (I don't know if you can deny a whole sub-directory in one statement.
Yes you can. You can put a separate web.config file in the folder you want secure

mysecurefolder/
<configuration>
  <system.web>
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
</configuration>

 
Old April 30th, 2004, 12:43 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi...This topic is quite interesting to me. So, if what you were saying is true about being able to specify authentication tag only in the root web.config, how would you achieve something like this.

I have 2 secure folders, say 'user' and 'admin'. I specify two web.config files within the folders with the autorization tag containing -- <deny users="?"> --. The problem is they have two different login pages. How can I redirect them to their corresponding login pages using the <authentication> tag??

I have been thinking about this for a while but couldn't come up with anything except making the two login pages same. This seems fine since there are only two types of users in this case. What if we have 4 or 5 types of users???

SJ.


Quote:
quote:Originally posted by planoie
 So apparently I hadn't tried everyone's suggestions hard enough. I just tried and succeeded with a working solution that several people had pointed out. Not sure why I wasn't able to get it before.

It seems that you can only specify the login page details of forms authentication in the root web.config. However, it would seem to make sense that even with forms auth set up, you could still allow the root of the application to allow all anonymous users and restrict subdirectories (with supplemental web.config files) or individual files (with the <location> nodes in the web.config(s)).

I was looking at the comments in the default web.config and began thinking about something. The comment says "Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated) users".

So wouldn't that imply that this:

    <allow users="?" />

would allow anonymous but deny authenticated users? That's the way I interpret it. But it doesn't perform that way. I guess the concept of an "anonymous" user is kind of loose.

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms Authentication "Page cannot be displayed" rayman ASP.NET 2.0 Professional 2 April 24th, 2008 01:54 AM
Help Using LDAP user authentication in ASP page dreamzentrue Classic ASP Basics 0 November 11th, 2005 01:33 PM
SQL Help on Users and Authentication page 149 seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 26th, 2004 09:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.