Javascript Cookie删除
问题描述:
我已经使用名为jsdetect的javascript创建了cookie,并设置了有效期(天).
当我使用C#代码Request.cookies["jsdetect"].expires
检查Cookie的到期日期时,始终显示01/01/0001
如何使用在javascript中创建的c#清除cookie.
请执行需要的操作.
I have created cookie using javascript named jsdetect and set the expiry in days.
When I check the cookie expiry date using c# code, Request.cookies["jsdetect"].expires
,it is showing 01/01/0001 always
How can I clear the cookie using c# which was created in javascript.
Please do the needful.
答
这里是一种实现方法:
Here''s a way to do it:
HttpContext.Current.Response.Cookies.Remove("jsdetect");
已将此 ^ ]