我是 asp.net 的初学者..我目前有一个登录页面,屏幕底部有一个忘记密码链接按钮。我还使用表单身份验证来防止未经授权的用户访问其他页面。除了一件事之外,身份验证似乎工作正常。一旦用户单击链接按钮,它就会阻止用户访问密码恢复页面。如何允许所有用户访问登录/密码页面,并阻止他们在未经身份验证的情况下查看其他页面?
下面的代码是为了防止其他匿名者查看其他没有访问权限的页面。但我不知道如何允许他们访问密码恢复页面......
<authentication mode="Forms">
<forms loginUrl="/Presentation/Display/Login.aspx" name=".ASPNETAUTH" protection="All" path="/" timeout="120" cookieless="UseDeviceProfile" slidingExpiration="true"/>
</authentication>
<!-- This section denies access to all files in this application except for those that you have not explicitly specified by using another setting. -->
<authorization>
<deny users="?"/>
</authorization>
您需要使用<location>
元素将设置应用于特定路径,然后添加<allow />
对于未登录的用户。
例如:
<location path="PasswordRecovery.aspx">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)