Click here to Skip to main content
15,904,287 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<configuration>
<location path="admin">
    <system.web>
      <authentication mode="Forms">
        <forms cookieless="AutoDetect"
                name=".3D"
             slidingExpiration="true" >
          <credentials passwordFormat="Clear">
            <user name="Bill" password="secret_" />
            <user name="Ted" password="secret_" />
          </credentials>
        </forms>
      </authentication>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
 </location>
</configuration>


In my project i am using just one web.config.
This is the part of web.config which in root. and i am trying to protect admin subfolder. but it is giving the following 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.
Posted
Updated 21-Apr-11 20:46pm
v3

Generally this happens when you have more than one Web.Config file in your application root folder.
Just check if you have more than one. If so, remove the duplicate copies.

Read a similar issue resolved here:ASP.NET 2.0 & "allowDefinition='MachineToApplication'" error message[^]

Other useful link that has similar issue discussed: http://forums.asp.net/p/769696/769696.aspx[^]
 
Share this answer
 
Comments
jaspalsingh183 22-Apr-11 4:07am    
solved from
http://www.codefixer.com/asp-net/tutorials/protecting-folders-with-forms-authentication.asp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900