提交按钮时如何删除Cookie [英] how can we delete cookies when submit button

查看:126
本文介绍了提交按钮时如何删除Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果按f5键然后将重复的条目插入数据库中,那么如何在提交按钮becoz时删除cookie?.

how can we delete cookies when submit button becoz if We press f5 key then duplicate entry insert into data base so how can we delete cookies..

推荐答案

您首先需要修复您的代码.通常,您的问题没有任何意义.您说我们怎么做xxx,因为我的代码已损坏,并且在不向您显示代码的情况下,我认为这是解决问题的方法".由于删除Cookie是很容易发现的事情,因此使用Google的好处是,您最好向我们展示您的代码,并让我们告诉您如何解决它,而不是假设该 [
You need to fix your code in the first place. In general, your question makes no sense. You said ''how can we do xxx, because my code is broken, and without showing you the code, I''ve assumed that this is how to fix it''. As deleting cookies is something that''s very easy to find out how to do, using google, odds are good that you''d do better to show us your code, and let us tell you how to fix it, rather than assuming that this[^] will fix it.




为此,您需要设置到期日期和时间.
这就是您的方法.

下面的代码使用C#,您可以将其转换为所需的任何语言.

Hi,

For doing so you need to set the expiration date and time.
This is how you can do.

The below code is in C#, you can convert the same to which ever language you want.

Response.Cookies["YourCookieName"].Expires = DateTime.Now.AddDays(-1d);




问候

Shiv




Regards

Shiv


这篇关于提交按钮时如何删除Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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