By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,369 Members | 2,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,369 IT Pros & Developers. It's quick & easy.

authentication mode error

P: n/a
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
Jan 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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/de...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" <jb*******@noemail.noemail>
| 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: <up*************@TK2MSFTNGP12.phx.gbl>
| 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!TK2MSFT NGP12.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
|
|
|

Jan 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.