如何重定向与窗体身份验证的用户密码恢复页 [英] How to redirect the user to password recovery page with forms authentication

查看:166
本文介绍了如何重定向与窗体身份验证的用户密码恢复页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我asp.net..I的初学者目前有一个登录页面忘记在屏幕底部密码链接按钮。我也使用窗体身份验证,以prevent访问其他页未经授权的用户。认证似乎是工作的罚款除了一件事。它$ P $访问密码恢复页上一次的链接按钮,用户点击pvents用户。如何允许所有用户访问登录/密码的页面,也prevent他们查看其他页面,如果他们不进行身份验证?

在code以下是从其他匿名查看其它页面prevent得不到。但我得到了关于如何允许他们访问密码恢复页不知道...

 <身份验证模式=表格>
  <ASPNETAUTH形式loginUrl =/ presentation /显示/的Login.aspxNAME = =保护全部路径=/超时=120无Cookie =UseDeviceProfileslidingExpiration =真/ >
< /认证>
<! - 这部分拒绝访问所有文件在此应用中,除了那些你没有明确使用另一种指定。 - >
<授权>
  <拒绝用户= /&gt的帮助?
< /授权>


解决方案

您需要使用<地点> 元素来设置应用到特定的路径,然后加入一个<允许/方式> 对于非登录用户

例如:

 <位置路径=PasswordRecovery.aspx>
    <&的System.Web GT;
        <授权>
            <让用户=? />
        < /授权>
    < /system.web>
< /地点>

I am a beginner of asp.net..I currently have a login page with forgot password link button on the bottom of the screen. I am also using forms authentication to prevent an unauthorized user from accessing the other pages. The authentication seems to be working fine except for one thing. It prevents the user from accessing the password recovery page once the user click on the link button. How do I allow all users access to the login/password pages and also prevent them from viewing the other pages if they are not authenticated?

The code below is to prevent from other anonymous view other pages without access. But i got no idea on how to allow them to access password recovery page...

<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>

解决方案

You need to use the <location> element to apply settings to a specific path, then add an <allow /> for non-logged-in users.

For example:

<location path="PasswordRecovery.aspx">
    <system.web>
        <authorization>
            <allow users="?" />
        </authorization>
    </system.web>
</location>

这篇关于如何重定向与窗体身份验证的用户密码恢复页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆