|
-
May 15th, 2007, 03:30 AM
#1
Thread Starter
Fanatic Member
{RESOLVED} Releasing cookies...
Hi...
I'm using C# (Vis .NET 2005) for Web Application.
I've got a simple question to ask, coz I confuse on this thing.
I've created a cookies at my Login form, named = "strUser".
And I also add 1 button to Logout from system.
I need to release that cookie when user press Logout button.
I've tried to set the expires to 1 second, but nothing change.
Code:
logCookie.Expires = DateTime.Now.AddSeconds(1);
I've also try to set the value to null, also not work.
Code:
logCookie.Value = null;
And I've also tried to remove the cookie... this one ? also not work.
Code:
Request.Cookies.Remove("strUser");
And finally, I've tried to clear the cookie. oh boy... also not work.
Code:
Request.Cookies.Clear();
please someone help me on how to remove that cookies....
thanks....
Regards,
~ Wj ~
SQL Server 2005 Developer
Last edited by Wen Lie; May 15th, 2007 at 05:46 AM.
Reason: resolved
-
May 15th, 2007, 03:52 AM
#2
Re: Releasing cookies...
Try this and you should be ok. You are expiring the cookie and sending it back to the client in the response.
Code:
Response.Cookies["strUser"].Expires = System.DateTime.Now.AddDays(-1);
Last edited by Fishcake; May 15th, 2007 at 03:57 AM.
Reason: Syntax
-
May 15th, 2007, 05:44 AM
#3
Thread Starter
Fanatic Member
Re: Releasing cookies...
hello fishcake...
thanks... it works...
^_^
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|