清除浏览器上的Cookie关闭 [英] Clear cookies on browser close

查看:396
本文介绍了清除浏览器上的Cookie关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户关闭浏览器时,如何清除通过我的asp.net mvc(C#)应用程序存储的Cookie?

How to clear the cookies that has been stored through my asp.net mvc(C#) application, when the user closes the browser?

创建一个cookie,使其在浏览器关闭后过期?

Is there any option to create a cookie such that it expires once the browser closed?

我需要使用cookie,因为我将存储一些值,直到浏览器关闭。

I need to use cookies, because i will store some of the values to be maintained until the browser is closed.

例如,在登录期间i可以将cookie存储在cookie中,我可以用于我的申请流程,直到bwoser关闭。

For example, During sign in i may store the userid in cookie, which i can use for my application processes till the bwoser closes.

会话将在特定时间过后使用cookies克服。

Session will expire after some particular time, which i need to overcome with using cookies

推荐答案

会话通常用于此。根据维基百科,如果未设置过期日期,则当用户

Sessions are usualy used for this. According to Wikipedia, when no expiration date is set, a cookie is cleared when the user closes the browser.


Cookie设置器可以指定删除日期,在这种情况下,该cookie将在该日期删除。如果Cookie设置器未指定日期,则在用户退出浏览器后,系统会移除Cookie。

The cookie setter can specify a deletion date, in which case the cookie will be removed on that date. If the cookie setter does not specify a date, the cookie is removed once the user quits his or her browser.

这篇关于清除浏览器上的Cookie关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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