如何保持从重写我的ASP.NET登录控件的属性DestinationPageUrl我的Login.aspx页的RETURNURL参数? [英] How do I keep my Login.aspx page's ReturnUrl parameter from overriding my ASP.NET Login control's DestinationPageUrl property?

查看:333
本文介绍了如何保持从重写我的ASP.NET登录控件的属性DestinationPageUrl我的Login.aspx页的RETURNURL参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 ASP.NET登录控件并的表单验证为ASP.NET Web应用程序的会员/凭据。我得如的 PasswordRecovery.aspx 的是accessable只能匿名用户的页面。当我点击从这样的页面我的登录链接,登录页面有一个 RETURNURL 的在地址栏中参数:

I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only Anonymous users. When I click my login link from such a page, the login page has a ReturnUrl parameter in the address bar:

<一个href=\"http://www.example.com/Login.aspx?ReturnUrl=PasswordRecovery.aspx\">http://www.example.com/Login.aspx?ReturnUrl=PasswordRecovery.aspx

和则成功登录后,用户将返回到的 PasswordRecovery.aspx 的规定页的 RETURNURL 的参数,它们不再具有访问权限。

And then after a successful login, users are returned to the PasswordRecovery.aspx page specified in the ReturnUrl parameter to which they no longer have access.

推荐答案

我发现的速度点评的。我处理的事件的loggedIn强制重定向到DestinationPageUrl页面。

I found the answer on Velocity Reviews. I handled the LoggedIn event to force a redirection to the DestinationPageUrl page.

Public Partial Class Login
    Inherits System.Web.UI.Page

    Protected Sub Login1_LoggedIn(ByVal sender As Object, _  
            ByVal e As System.EventArgs) Handles Login1.LoggedIn
        'overrides ReturnUrl page parameter
        Response.Redirect(Login1.DestinationPageUrl)
    End Sub

End Class

这篇关于如何保持从重写我的ASP.NET登录控件的属性DestinationPageUrl我的Login.aspx页的RETURNURL参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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