473,651 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "authentica tion 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 ='MachineToAppl ication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS. D:\WebSites\Reg encyWeb\web.con fig 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 2386
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*******@gmai l.comwrote in message
news:56******** *****@mid.indiv idual.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 "authentica tion 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 ='MachineToAppl ication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS. D:\WebSites\Reg encyWeb\web.con fig 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
270
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 when the user is authenticated, I have FormsAuthentication.RedirectFromLoginPage(txtLogonid.Text, False) And in the web.config files of my subdirectory, I have
4
1956
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 that allows me to do it using Forms authenication? thanks in advance Gawel
7
305
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 SignOn.aspx to the sign on page in the application's root directory. However, if I move to a page in one of the subdirectories it requires me to log in again. Once I log in successfully it keeps sending me back to my sign in page. Does anyone have any...
2
1258
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 have to require that a user login in before they access it (the contact/about page for example). I've tried copying all my 'secure' pages to a sub-directory of my application and then set up the web.config in this sub-dir to use forms, leaving the...
11
2205
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 username/password are hardcoded into the code-behind C# code. How can I write my web.config to make this happen? Thanks.
2
1736
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 be running in the context of a wrong directory. images, style sheets and jscripts files placed in app directory (or in subdirectories) suddenly become invisible to the application. when I move the application to the IIS, it works as expected but...
3
1156
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 store the reports for a job. I can access the reports fine through my application. However, if I save the link to a report, I can open it without logging into the application, which would be a security issue.
2
1841
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 with authentication process, like my other ASP 3.0 sites that I developed with classical session variables to follow each user with some personal data (like role, e-mail address, preferences, ect.).
2
1650
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 file and set the authentication rules there. However, when I do that, I get this error: -------------------------- Parser Error Message: It is an error to use a section registered as
0
8349
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8695
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8576
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.