470,631 Members | 2,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

Session cookie? Browser instance cookie?

Ben
Hi, I'm sending out a session cookie. That is a cookie that has no
expiration date. When I surf through the site, no problems, but if I close
the browser and open it back up, the cookie is still there if other browser
windows were open. Even if those windows didn't go to the site with the
cookie or spawn from the browser that is visiting the site. This is causing
a problem. People want to be able to close the browser to logout.

How can I achive this in asp.net? Basically if they close the browser that
was at the site, I want that cookie gone. The cookie persisting across
browsers that haven't touched the site seems odd...

If I close all open browsers, the cookie is finally destroied.

TIA,
Ben

Nov 18 '05 #1
3 2099
"Ben" <be*@online.nospam> wrote in message
news:uG*****************@fe37.usenetserver.com...
Hi, I'm sending out a session cookie. That is a cookie that has no
expiration date. When I surf through the site, no problems, but if I close the browser and open it back up, the cookie is still there if other browser windows were open. Even if those windows didn't go to the site with the
cookie or spawn from the browser that is visiting the site. This is causing a problem. People want to be able to close the browser to logout.

How can I achive this in asp.net? Basically if they close the browser that was at the site, I want that cookie gone. The cookie persisting across
browsers that haven't touched the site seems odd...


Sorry, this isn't an ASP.NET issue, it's a browser issue. In the case of IE,
if you launch one copy of IE, then use it to create several other windows
(using Ctrl-N, for instance), then they are all running in the same process,
and they share cookies. If you launch a separate process, it will not share
the cookies of the first one. This may work differently with different
browsers, but I'd expect many if not most to share cookies.

You might consider using hidden form fields instead of cookies.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Ben
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:uG*************@tk2msftngp13.phx.gbl...
"Ben" <be*@online.nospam> wrote in message
news:uG*****************@fe37.usenetserver.com...
Hi, I'm sending out a session cookie. That is a cookie that has no
expiration date. When I surf through the site, no problems, but if I close
the browser and open it back up, the cookie is still there if other

browser
windows were open. Even if those windows didn't go to the site with the
cookie or spawn from the browser that is visiting the site. This is

causing
a problem. People want to be able to close the browser to logout.

How can I achive this in asp.net? Basically if they close the browser

that
was at the site, I want that cookie gone. The cookie persisting across
browsers that haven't touched the site seems odd...


Sorry, this isn't an ASP.NET issue, it's a browser issue. In the case of

IE, if you launch one copy of IE, then use it to create several other windows
(using Ctrl-N, for instance), then they are all running in the same process, and they share cookies. If you launch a separate process, it will not share the cookies of the first one. This may work differently with different
browsers, but I'd expect many if not most to share cookies.

You might consider using hidden form fields instead of cookies.
--
John Saunders
johnwsaundersiii at hotmail

I don't remember this being an issue in asp. Maybe it was. I'll have to
test with sessions. I didn't think sessions worked like that. Maybe I can
store a session id with the cookie.

Nov 18 '05 #3
Thanks for John's informative suggestions.

Hi Ben,

I think John's suggestions are quite correct and you may done some simple
tests to confirm this.
A simple way is enable the ASP.NET page's Trace and view the cookie
collection.
1.If we use Ctrl-N to start multi browsers when an exsiting IE is started,
they'll share cookies and Also use the
same session(since sessionId bedefault is stored in cookie)

2. IF we lanuch a new IE browser instance, they won't share the cookies(not
persistent or set expire) and will use a
new sessionID if it visit the same application

In addition, the most important is such behavior is diffferent for
different browsers. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by mrbog | last post: by
3 posts views Thread by Richard P | last post: by
5 posts views Thread by Ňěenol Akbulak | last post: by
8 posts views Thread by Mantorok | last post: by
4 posts views Thread by rgparkins | last post: by
13 posts views Thread by Samir Chouaieb | last post: by
11 posts views Thread by Glenn | last post: by
4 posts views Thread by Zhangming Su | last post: by
16 posts views Thread by Jonathan Wood | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.