调用window.close()是否也从IIS终止会话?

时间:2012-10-22 06:49:05

标签: .net vbscript

我想知道当我们调用window.close时,这是否也会终止IIS上的会话?

我正在编写下面的代码,我正在尝试从IIS终止用户的会话。

  Sub OnClickLogout() 
      dim Answer, msg
      Msg = "This will terminate the session and close the browser. Do you want to continue?"
      Answer = MsgBox(Msg, vbYesNo + vbCritical, "Error")
      if Answer = vbYes then
          window.close() ' Does this terminate the sesion of the user also?
      else
         'Return to the previous page             
      End if
  End Sub

如果没有,那么请告诉我如何才能实现它。

1 个答案:

答案 0 :(得分:1)

关闭浏览器不会终止会话。您可以通过将Global.asax文件添加到项目中来检查这一点,并获得对会话结束事件的控制。

   void Session_End(object sender, EventArgs e)
   {
   }

有关会话活动的更多信息,请访问:

http://msdn.microsoft.com/en-us/library/ms178583(v=vs.100).aspx

要终止会话,您应该致电:

        Page.Session.Clear();
        Page.Session.Abandon();