intraweb 关闭页面session如何销毁(100)

  • 主题发起人 zhai2008
  • 开始时间
Z

zhai2008

Unregistered / Unconfirmed
GUEST, unregistred user!
intraweb9.0.32,做的网页在关闭页面时session如何销毁,不等sessiontimeout到时销毁,而是关闭页面时立即销毁
 
设置客户端的cookie在网页关闭后立即失效就可以了,服务器端的不可以控制,因为客户端关闭与否这个信息服务器是不知道的
 
二樓的理解不正确,按照下面的方法就行,我的程序就是这么做的要关闭的页面上IWRecCloseInfo: TIWRectangle; comgrid0: TIWDBGrid;给comgrid0随便加上一列,给这一列写上点击事件:procedure Tmainform.comgrid0Columns0Click(ASender: TObject; const AValue: string);begin UserSession.closesessoion;end; 捕获IE关闭时的信息:procedure Tmainform.IWAppFormRender(Sender: TObject);var closestr: string;begin closestr := '<script FOR=window EVENT=onunload>if (window.event.clientY <0) ' + '{SubmitClickConfirm(''ComGrid0'',''0_close'', true, '''');window.alert(''谢谢访问预算控制系统,欢迎下次再来!'');}</script>'; IWRecCloseInfo.Text := closestr;end;在UserSessionUnit中自定义一个过程:procedure TIWUserSession.closesessoion;begin try if (WebApplication.FindComponent('mainform') as TIWContainer) <> nil then (WebApplication.FindComponent('mainform') as TIWContainer).free; except Exit; end;end;一切都OK了,试试吧,这样就行了如果关闭页是用了模板的,要在模板上加入{%IWRecCloseInfo%},反正也看不见,放哪儿都行
 
接受答案了.
 

Similar threads

回复
0
查看
827
不得闲
S
回复
0
查看
631
SUNSTONE的Delphi笔记
S
S
回复
0
查看
710
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部