authentication mode error

J

Joe

What I want to do is make only one page require a login. The application
itself works fine.

I'm getting the following error:
Parser Error Message: 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.

Source Error:


Line 105: <location path="LoginTest.aspx">
Line 106: <system.web>
Line 107: <authentication mode="Forms">
Line 108: <forms name=".ASPXAUTH" loginUrl="Login.aspx" timeout="30"/>
Line 109: </authentication>

Here's my config:
<!-- *** This is the original lines **** -->
<authentication mode="Forms">

</authentication>

<!-- AUTHORIZATION
This section sets the authorization policies of the application.
You can allow or deny access
to application resources by user or role. Wildcards: "*" mean
everyone, "?" means anonymous
(unauthenticated) users.
-->

<authorization>
<allow users="*" /> <!-- Allow all users -->
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>

<!-- *** I added these lines at the end of my file just ahead of the closing
</configuration> *** -->

<location path="LoginTest.aspx">
<system.web>
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx" timeout="30"/>
</authentication>

<authorization>
<deny users = "?"/>

</authorization>
</system.web>
</location>

If I comment out the <authentication mode="Forms"> section, I get my login
screen but right after that I get the Windows login screen.

Any ideas?

Thanks,
Joe
 
S

Steven Cheng[MSFT]

Hi Joe,

Welcome to ASPNET newsgroup.
As for the Authentication Mode error, it is because <authentication>
setting is a MachineToApplication level setting which means it can only be
configured at machine .config or only once in each asp.net application's
main web.config. It can not be configured multiple times by using sub
dir's web.config or the <location > element as you used....

For your scenario, you'd like to grant access protection to an individule
page (or a sub folder), we can configure using the <authorization> element
, this is used for user or role based access permission to pages and can
be configured for individual pages or sub dirs. e.g:

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


#<authorization> Element
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
ml/gngrfauthorizationsection.asp

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "Joe" <[email protected]>
| Subject: authentication mode error
| Date: Wed, 11 Jan 2006 05:42:33 -0500
| Lines: 66
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 69.37.58.70.adsl.snet.net 69.37.58.70
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:370029
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| What I want to do is make only one page require a login. The application
| itself works fine.
|
| I'm getting the following error:
| Parser Error Message: 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.
|
| Source Error:
|
|
| Line 105: <location path="LoginTest.aspx">
| Line 106: <system.web>
| Line 107: <authentication mode="Forms">
| Line 108: <forms name=".ASPXAUTH" loginUrl="Login.aspx" timeout="30"/>
| Line 109: </authentication>
|
| Here's my config:
| <!-- *** This is the original lines **** -->
| <authentication mode="Forms">
|
| </authentication>
|
| <!-- AUTHORIZATION
| This section sets the authorization policies of the
application.
| You can allow or deny access
| to application resources by user or role. Wildcards: "*" mean
| everyone, "?" means anonymous
| (unauthenticated) users.
| -->
|
| <authorization>
| <allow users="*" /> <!-- Allow all users -->
| <!-- <allow users="[comma separated list of users]"
| roles="[comma separated list of roles]"/>
| <deny users="[comma separated list of users]"
| roles="[comma separated list of roles]"/>
| -->
| </authorization>
|
| <!-- *** I added these lines at the end of my file just ahead of the
closing
| </configuration> *** -->
|
| <location path="LoginTest.aspx">
| <system.web>
| <authentication mode="Forms">
| <forms name=".ASPXAUTH" loginUrl="Login.aspx" timeout="30"/>
| </authentication>
|
| <authorization>
| <deny users = "?"/>
|
| </authorization>
| </system.web>
| </location>
|
| If I comment out the <authentication mode="Forms"> section, I get my
login
| screen but right after that I get the Windows login screen.
|
| Any ideas?
|
| Thanks,
| Joe
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top