DestinationPageUrl 第一次不工作

DestinationPageUrl not working first time

我正在使用 visual studio 2010。

我在我的页面上放了一个登录组件,当我第一次尝试登录我的用户时,该页面再次将我重定向到页面日志,然后我再次登录并且工作正常。我没有写错密码,因为它被 Chrome 记住了。

ASP代码:

<asp:Login ID="lgnLogin" runat="server" BorderColor="#39516B" BorderPadding="0"
                    BorderStyle="Solid" BorderWidth="1px" Height="203px" Width="450px" 
                    Font-Bold="True" ForeColor="#182B39" RememberMeText="Save password" 
                    style="text-align: center" BackColor="#E7EAEF" DisplayRememberMe="False" 
                    OnAuthenticate="lgnLogin_Authenticate" DestinationPageUrl="~/bandejaEntrada.aspx">
</asp:Login>

C#代码:

protected void lgnLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
        try
        {
            //Clear session
            Session.Clear();

            // Create new session
            CSessionUser oSesUser = new CSessionUser();
            e.Authenticated = oSesUser.BInitSession(lgnLogin.UserName, lgnLogin.Password);
            CLogger.MsgInfo("authen: " + e.Authenticated.ToString());

            CSesionSrv oSesionSrv = new CSesionSrv();
            oSesionSrv.BGuardar(lgnLogin.UserName);

            //lgnLogin.DestinationPageUrl = "~/bandejaEntrada.aspx";
            //Response.Redirect("~/bandejaEntrada.aspx",false);
            //Response.Redirect(ResolveClientUrl(lgnLogin.DestinationPageUrl));                
        }
        catch(Exception ex) 
        {
            CLogger.MsgError("Web:login.aspx.cs:lgnLogin_Authenticate", ex);
        }
 }

e.Authenticated 属性始终为真,即使是第一次页面将我重定向到登录页面时也是如此。

是什么导致了这种行为?

非常感谢!

最后我修改了 IIS 中的默认文档,我把 login.aspx 放在列表的末尾,我把 bandejaEntrada.aspx 放在列表的顶部。现在,当参数 login.aspx?ReturnUrl=%2fWEBSITE%2f 出现在浏览器中时,它会再次重定向到 bandejaEntrada 而不是登录页面。