0

如果他们的密码有效,我将使用此功能重定向我的用户:

if (ValidateUser(txtUsername.Text, txtPassword.Text))
        {
            FormsAuthenticationTicket tkt;
            string cookiestr;
            HttpCookie ck;
            tkt = new FormsAuthenticationTicket(1, txtUsername.Text, DateTime.Now,
      DateTime.Now.AddHours(12), chkPersistCookie.Checked, "your custom data");
            cookiestr = FormsAuthentication.Encrypt(tkt);
            ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
            if (chkPersistCookie.Checked)
                ck.Expires = tkt.Expiration;
            ck.Path = FormsAuthentication.FormsCookiePath;
            Response.Cookies.Add(ck);

            string strRedirect;
            strRedirect = Request["ReturnUrl"];
            if (strRedirect == null)
                strRedirect = "default.aspx";

            Response.Redirect(strRedirect, true);
        }
        else
            lblStatus.Text = "Incorrect Username or Password, please try again.";

它在我测试过的每个平台上的每个浏览器上都能正常工作,除了我的 Surface 平板电脑上的 IE。通过 Metro 应用程序或桌面版本。它只是重新加载到屏幕上的原始空白日志。有人遇到过这个问题吗?

4

0 回答 0