我有以下设置,但是当我访问ManageContacts.aspx(来自IIS express)时,它并没有指向login.aspx,我做错了什么?简单密码仅供参考。
<location path="~/ManageContacts.aspx">
<system.web>
<authorization>
<deny users="?"/>
<allow users="admin"/>
</authorization>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login">
<credentials>
<user name="admin" password="123456"/>
</credentials>
</forms>
</authentication>
</system.web>
</location>
答案 0 :(得分:0)
请尝试以下代码:
<configuration>
<system.web>
<authentication mode="Forms">
<forms loginurl="Account/Login.aspx" name=".ASPNETAUTH" protection="None" path="/" timeout="20" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
<location path="ManageContacts.aspx">
<system.web>
<authorization>
<deny users="?" />
<allow users="admin" />
</authorization>
</system.web>
</location></configuration>