user1265533
user1265533

Reputation: 173

Forms Authentication won't Work

I have been trying to no-avail to get Forms Authenticaiton to work on my project. Right now it is just local and I am running it through Visual Studio.

1st Try(Using root Directory Web.Config):

<?xml version="1.0"?>
<configuration>
<location path="~/Account/Admin.aspx">
<system.web>
  <authorization>
    <deny users="*"/>
    <allow users="*"/>
  </authorization>
  <authentication mode="Forms">
    <forms loginUrl="Login.aspx" timeout="30" name=".ARBBADMIN" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx">
      <credentials passwordFormat="Clear">
        <user name="user1" password="pass1"/>
      </credentials>
    </forms>
  </authentication>
</system.web>
</location>

</configuration>

Does not work, even when I try to deny ALL users

2nd Option, I put a seperate web.config inside the account folder, and I get this 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.

I've googled it and researched and the solution is to make the folder an IIS Directory, Which , I have no idea how to do while running on localhost. `

Upvotes: 1

Views: 249

Answers (1)

Imran Rizvi
Imran Rizvi

Reputation: 7438

Why are you allowing same user group and denying it again

<authorization>
 <deny users="*"/>
 <allow users="*"/>
</authorization>

I guess following is enough to allow all users

<authorization>
 <allow users="*"/>
</authorization>

Correct me if I did not understand question properly.

Upvotes: 1

Related Questions