thanks ..i will give this a try .. what i am looking for is when you go to IE developer tool bar , on the cache menu there is a option called clear session cookies ..my application works fine if i do select this option ... i want to know how to do this in
c# or javascript or jquery ...
rupak_raj6
0 Points
8 Posts
How to delete session cookies ?
Apr 18, 2012 11:08 AM|LINK
Hi .. i have some session cookies (NON http only) set . They are deleted when the session ends or when the user closes the browser.
I want to explicitly clear them . How to do this with c# or javascript or jquery code ?
Sandeep Shen...
Participant
1678 Points
492 Posts
Re: How to delete session cookies ?
Apr 18, 2012 11:09 AM|LINK
HI refer the link below..
http://msdn.microsoft.com/en-us/library/ms178195.aspx
Skype : sandeep.d.shenoy
Gmail : sandeepdshenoy@gmail.com
ignatandrei
All-Star
134843 Points
21605 Posts
Moderator
MVP
Re: How to delete session cookies ?
Apr 18, 2012 11:11 AM|LINK
False. If the user closes the browser , then nothing happens.( if not user settings on clear cookies on exit)
See http://msdn.microsoft.com/en-us/library/ms178195.aspx
rupak_raj6
0 Points
8 Posts
Re: How to delete session cookies ?
Apr 19, 2012 05:53 AM|LINK
thanks ..i will give this a try .. what i am looking for is when you go to IE developer tool bar , on the cache menu there is a option called clear session cookies ..my application works fine if i do select this option ... i want to know how to do this in c# or javascript or jquery ...
vijay_myl
Contributor
5070 Points
1068 Posts
Re: How to delete session cookies ?
Apr 19, 2012 09:35 AM|LINK
try ths code....
Session.Abandon() Response.Cookies.Clear()My .NET blog
Submit Article
rupak_raj6
0 Points
8 Posts
Re: How to delete session cookies ?
Apr 19, 2012 10:52 AM|LINK
tried all the following approaches...but i can still see the cookies in fiddler tool ..they r not deleted...any pointer here ?
Session.Abandon(); Response.Cookies.Clear();
$.cookie("FSDGCServer", null);
also tried setting expiry date to past date.
vijay_myl
Contributor
5070 Points
1068 Posts
Re: How to delete session cookies ?
Apr 21, 2012 01:09 PM|LINK
HI..
Refer the below articles ..How to delete cookies when the user closes the browser...
http://www.dotnetcode.in/2012/04/delete-all-cookies-when-user-closes.html
My .NET blog
Submit Article
knitesh
Member
2 Points
2 Posts
Re: How to delete session cookies ?
Feb 19, 2013 08:31 PM|LINK
Using Javascript you can set the value of cookies but can't delete it. To delete it explicitly on some event use below code
If (someeventhappened) { If(!Page.Request.Cookies["SessionId_"]!=null) { Response.Cookies["SessionId_"].Expires = DateTime.Now.Add(-10); } Session.Abandon(); }