using Form Authentication in subfolder

Last post 08-28-2007 11:33 PM by orka777. 1 replies.

Sort Posts:

  • using Form Authentication in subfolder

    08-28-2007, 9:14 AM
    • Member
      47 point Member
    • MAlex001
    • Member since 09-14-2005, 5:49 PM
    • Posts 79

    Hi,

    My web site does not need any authentication. Users can enter without entering a username and password. But now i want to add a collection of pages that ony

    users that log in can access. I placed all the new pages in a subfolder called manager and added the next code in the web config:

    <location path="manager">

    <system.web>

    <authentication mode="Forms">

    <forms loginUrl="/manager/Acceso.aspx"></forms>

    </authentication>

    <authorization>

    <allow roles="Manager"/>

    <deny users="?"/>

    </authorization>

    When execute the application I get the next error :

    "It is incorrect to utilize a registered section as allowDefinition =' MachineToApplication' but there of the level of application. ...."

    I tried to place a new config file inside the subfolder with the authenctication tag but i get the same problem.

    What am doing wrong?

    It that the best way to implement authentication for part of a web side??

    Thank you in advance

     

  • Re: using Form Authentication in subfolder

    08-28-2007, 11:33 PM
    Answer
    • Member
      126 point Member
    • orka777
    • Member since 03-05-2007, 2:50 PM
    • Posts 24

    Use main web.config to set up form authentication (login form etc). In your sub-folder have web.config in a following format

    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
       <system.web>
          <authorization>
             <allow roles="Admin,Editor" />
             <deny users="*" />
          </authorization>
       </system.web>

       <location path="Default.aspx">
          <system.web>
             <authorization>
                <allow roles="Admin,Editor" />
                <deny users="*" />
             </authorization>
          </system.web>
       </location>
    </configuration>

Page 1 of 1 (2 items)
Microsoft Communities