我做了一个登录页面login.aspx,上面的登录按钮事件如下protected void Button1_Click(object sender, EventArgs e)
        {
            string uid = "kw";
            string logName = TextBox1.Text;
            string logpassword = TextBox2.Text;
            keewit.BLL.LoginBLL loginbll = new keewit.BLL.LoginBLL();
            if (loginbll.getLoginOn(uid, logName, logpassword))//如果登录验证通过
            {
                HttpCookie authCookie = FormsAuthentication.GetAuthCookie(logName, true);
                HttpContext.Current.Response.Cookies.Add(authCookie);
                Page.RegisterStartupScript("", "<script>openWindow('mainframe.htm','mainwin','1024','768')</script>");//在此打打一个新的窗口(fullscreen=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1)
            }
}在打开的mainframe.htm(框架)TOP 页(top.apsx)有一个logout按钮
事件如下protected void Button1_Click(object sender, EventArgs e)
{
   FormsAuthentication.SignOut();      
}web.config:   <authentication mode="Forms">
      <forms loginUrl="Login.aspx" name=".keewit"></forms>
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>当我在点top.aspx的logout按钮时,mainframe的TOP会将页面导航到登录页面,此时,我在login.aspx页面上点一下刷新,然后提示“不重新发送信息,则不刷新网页。点击重试再次发送信息,点击取消回到查看的网页”。我点重试后,注意,此时页面的登录名和密码都没有填写,但刷新后一样导航到了mainframe,且显示是正常的登录,请问这是怎么回事,如何解决。谢谢!!
再有,怎么样才能做到当我点击login页面的登录按钮时,打开mainframe后,关闭login页面,谢谢!!!

解决方案 »

  1.   

    打开mainframe后,关闭login页面
    window.opener.window.opener   =   null; 
    window.opener.window.close(); 
    清除所有COOKIEHttpContext.Current.Response.Cookies.Clear();
      

  2.   

    1、mainframe是一个框架集,我是想在点击login按钮,验证成功后关掉
    2、清除所有cookid这样写不行,还会出出我前面提到的刷新就出来的问题
      

  3.   

    在调用FormsAuthentication.SignOut(); 之后,用Response.Redirect("YourHomepage.aspx");然后在YourHomepage.aspx或者login.aspx里加些脚本<script>
    if (window != top)
      top.location.href = window.location.href;
    </script>
      

  4.   

    to 思归我是在login.aspx上写的代码。当验证成功后用window.open打开一个窗口,在这个找开的窗口上的logout按钮上写FormsAuthentication.SignOut(); 。当点击logout后,新开的窗口会退出到登录页面,但我在login.aspx上执行一个刷新动作时(此时,我将窗口的用户名和密码textbox都清空了),open打开的窗口又变成登录成功后的样式了,也就是说,只要我login.aspx不关闭,不管在哪singout,再刷新login.aspx,都可以再次进入系统。现在我想只要在任何地方singou,再刷新login.aspx都不能再进入open窗口了,而是要正常的输入密码才能进入。谢谢你!
      

  5.   

    另外,我的logout按钮要按两次才执行退出,这是怎么回事啊。