返回首页

我有tw0页

Default.aspx和login.aspx的。

我的登录页面上输入用户名和密码......问题是,当我直接调试login.aspx页面。 HTTP 404未找​​到错误来

但是,当我调试(运行)Default.aspx页面,并点击登录链接(下面是登录链接代码)。页面重定向到l​​ogin.aspx后,当我输入用户名和密码,它工作得很好...... login.aspx页面为何不直接

我有default.aspx页面上的登录链接

我把在default.aspx页面上的登录链接的代码和页面重定向到l​​ogin.aspx的

protected void lnklogin_Click(object sender, EventArgs e)

    {

        FormsAuthentication.SignOut();

        Session.Abandon();

 

        // clear authentication cookie

        HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");

        cookie1.Expires = DateTime.Now.AddYears(-1);

        Response.Cookies.Add(cookie1);

 

        // clear session cookie (not necessary for your current problem but i would recommend you do it anyway)

        HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", "");

        cookie2.Expires = DateTime.Now.AddYears(-1);

        Response.Cookies.Add(cookie2);

 

        FormsAuthentication.RedirectToLoginPage();

        

    }

它会重定向我的登录页面...
在登录页面中,我有一个代码
{C} GT; }
{体C3}

回答

评论会员: 时间:2
|