473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Troubled authentication in subdirectories

Hi there,

I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.

The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:

http://www.theserverside.net/tt/arti...Authentication

The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the protected
subdirectory.

Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:

Error 1 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS. D:\WebSites\RegencyWeb\web.config 42

If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.

So how can I solve this?

Thanks for any insight,

-Benton

Mar 24 '07 #1
1 2379
You can only have one authentication section in a web application. You don't
solve this, it's by design. The only thing you can do is alter the login
page based upon where the user is coming from, ie: which subdirectory. The
only other way is to make the subdirectories their own independent
application spaces. Of course, you can specify whatever authorization
limitations you want in the specific subdirectories, that doesn't matter,
just keeping in mind there can only be one authentication section and one
logon page.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Benton" <co*******@gmail.comwrote in message
news:56*************@mid.individual.net...
Hi there,

I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.

The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:

http://www.theserverside.net/tt/arti...Authentication

The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the
protected subdirectory.

Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:

Error 1 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS. D:\WebSites\RegencyWeb\web.config 42

If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.

So how can I solve this?

Thanks for any insight,

-Benton

Mar 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dotnet Guy | last post by:
I have set up forms authentication for my web application. I have several subdirectories inside a main directory and I have forms authentication for each of my sub directories. In the logon page...
4
by: Gawel | last post by:
Hajo, I know that I can not have two different <authenication> sections in ONE application. But I need to define two different login pages for two different subdirectories. Is it any workaround...
7
by: Andy M | last post by:
Hi, I am developing an ASP.NET application that uses forms authentication. However, it contains subdirectories, and they don't get authenticated somehow. I added a web.config and set the...
2
by: Andre | last post by:
I've got the basic forms based authentication going. A user has to go to my login page before they can access any other pages. The issue is that there are a sub-set of pages on which I don't...
11
by: xenophon | last post by:
I have a web site with forms authentication and a single logon page. I have 4 subdirectories, each that should be protected by a different username/password combination. For testing purposes, the...
2
by: Wiktor Zychla [C# MVP] | last post by:
Hi, I struggle for over an hour with the integrated Cassini web server. the problem I am facing is as follows: when I turn forms authentication on in the web.config file, the website seems to...
3
by: Gerhard | last post by:
Hi, I have an application where I want to store reports (.pdf, .doc) in a reports subdirectory. Within the reports subdirectory, I am creating other subdirectories (with a job number) where I...
2
by: Nicola Farina | last post by:
Hi all, I'm testing ASP.NET 1.1 authentications and cookies features, and I've red tons of tutorials and articles about this, but not all is clear for me. My goal is to create a basic site...
2
by: Darrel | last post by:
My app has an 'admin' folder. This is the only directory i need to apply forms authentication to. Googling seems to indicate that the solution is to just give the admin folder it's own config...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.