473,405 Members | 2,379 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,405 software developers and data experts.

forms authentication in subdirectory

I have an admin area in a sub directory of the root application that I am
trying to password protect with forms authentication with a web.config in the
subdirectory.

when I try to access the login page or any other pages I get this error:

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.

Any suggestions?

Thanks, Justin.
Nov 18 '05 #1
2 3056
The issue is that you can't put the Authentication node in sub directory
like that. One option would be to put your FormsAuthentication node in your
App Root and then use the location element to control whether or not you are
going require authentication.

Example (assuming the sub directory is "Admin"):

<!-- this would appear in the <system.web> section of your web.config -->
<authorization>
<allow users="*" /> <!-- Allow all users to the public location -->
</authorization>

<!-- this would appear in the configuration section (probably prior to
<system.web> -->
<location path="Admin">
<system.web>
<authorization>
<deny users="?" /> <!-- Require the Forms Authentication -->
</authorization>
</system.web>
</location>

I haven't tried that exact method personally but something like that might
at least be a start.

-Kyle

"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
I have an admin area in a sub directory of the root application that I am
trying to password protect with forms authentication with a web.config in the subdirectory.

when I try to access the login page or any other pages I get this error:

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.

Any suggestions?

Thanks, Justin.

Nov 18 '05 #2
Actually I have tried using the location element but it did'nt work like it
was suppose to, it protected the root directory not just the Admin directory.

Any ideas why it would do that?

"Kyle Eberle" wrote:
The issue is that you can't put the Authentication node in sub directory
like that. One option would be to put your FormsAuthentication node in your
App Root and then use the location element to control whether or not you are
going require authentication.

Example (assuming the sub directory is "Admin"):

<!-- this would appear in the <system.web> section of your web.config -->
<authorization>
<allow users="*" /> <!-- Allow all users to the public location -->
</authorization>

<!-- this would appear in the configuration section (probably prior to
<system.web> -->
<location path="Admin">
<system.web>
<authorization>
<deny users="?" /> <!-- Require the Forms Authentication -->
</authorization>
</system.web>
</location>

I haven't tried that exact method personally but something like that might
at least be a start.

-Kyle

"Justin" <Ju****@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
I have an admin area in a sub directory of the root application that I am
trying to password protect with forms authentication with a web.config in

the
subdirectory.

when I try to access the login page or any other pages I get this error:

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.

Any suggestions?

Thanks, Justin.


Nov 18 '05 #3

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

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
1
by: MJ | last post by:
I'm building an application that has a file structure similar to the following: /myapp/user_login.aspx /myapp/user_page_1.aspx /myapp/user_page_2.aspx /myapp/user_page_3.aspx...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
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...
7
by: Justin | last post by:
I am trying to password protect a subdirectory using forms authentication. I am using the "Location" tag to specify the directory to be protected. The login.aspx page is in the root directory of...
4
by: dhnriverside | last post by:
Hi guys Ok, I have a website which has an "Artists Only" section, for which you have to login for. This section is contained within its own directory on the server "/aonly". I want to make...
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...
1
by: Benton | last post by:
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...
0
by: Manuel Ricca | last post by:
Hi all, I need to protect a "members" area in my site for which I want to require forms authentication and allow only a specific role. This subdirectory must be accessible through SSL only....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
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...

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.