如何在Session End中清除cookie [英] How to clear cookie in Session End

查看:87
本文介绍了如何在Session End中清除cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

有没有办法在gloabal.aspx中清除会话结束事件中的cookie,因为请求在此块中不起作用。

Hello All,
Is there any way to clear cookie in session end event in gloabal.aspx as request not work in this block.

推荐答案

不,不是真的。

会话结束的重点是可能在另一端没有客户端 - 因此没有请求使用,因此没有响应无论是。这意味着您无法联系客户端,因此您无法设置cookie。



相反,请给cookie一个与会话将匹配的到期日期结束 - 通常在二十分钟之后 - 即使浏览器关闭,cookie也会失效!
No, not really.
The whole point of session end is that there likely isn't a client at the other end anymore - so there is no Request to use, and hence no Response either. Which means that you can't contact the client, so you can't set the cookies.

Instead, give the cookie an expiry date that matches when the session will end - normally after twenty minutes - and that way the cookie will be invalidated even if the browser is closed!


这篇关于如何在Session End中清除cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆