authentication mode error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    authentication mode error

    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 ='MachineToAppl ication' 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: <authenticati on mode="Forms">
    Line 108: <forms name=".ASPXAUTH " loginUrl="Login .aspx" timeout="30"/>
    Line 109: </authentication>

    Here's my config:
    <!-- *** This is the original lines **** -->
    <authenticati on 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
    (unauthenticate d) users.
    -->

    <authorizatio n>
    <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>
    <authenticati on mode="Forms">
    <forms name=".ASPXAUTH " loginUrl="Login .aspx" timeout="30"/>
    </authentication>

    <authorizatio n>
    <deny users = "?"/>

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

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

    Any ideas?

    Thanks,
    Joe


  • Steven Cheng[MSFT]

    #2
    RE: authentication mode error

    Hi Joe,

    Welcome to ASPNET newsgroup.
    As for the Authentication Mode error, it is because <authentication >
    setting is a MachineToApplic ation 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 <authorizatio n> 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:

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


    #<authorization > Element

    ml/gngrfauthorizat ionsection.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" <jbassking@noem ail.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: <upGL8upFGHA.37 6@TK2MSFTNGP12. phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
    | NNTP-Posting-Host: 69.37.58.70.ads l.snet.net 69.37.58.70
    | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
    | Xref: TK2MSFTNGXA02.p hx.gbl
    microsoft.publi c.dotnet.framew ork.aspnet:3700 29
    | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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 ='MachineToAppl ication' 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: <authenticati on mode="Forms">
    | Line 108: <forms name=".ASPXAUTH " loginUrl="Login .aspx" timeout="30"/>
    | Line 109: </authentication>
    |
    | Here's my config:
    | <!-- *** This is the original lines **** -->
    | <authenticati on 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
    | (unauthenticate d) users.
    | -->
    |
    | <authorizatio n>
    | <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>
    | <authenticati on mode="Forms">
    | <forms name=".ASPXAUTH " loginUrl="Login .aspx" timeout="30"/>
    | </authentication>
    |
    | <authorizatio n>
    | <deny users = "?"/>
    |
    | </authorization>
    | </system.web>
    | </location>
    |
    | If I comment out the <authenticati on mode="Forms"> section, I get my
    login
    | screen but right after that I get the Windows login screen.
    |
    | Any ideas?
    |
    | Thanks,
    | Joe
    |
    |
    |

    Comment

    Working...