Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session cookie? Browser instance cookie?

Reply
Thread Tools

Session cookie? Browser instance cookie?

 
 
Ben
Guest
Posts: n/a
 
      06-02-2004
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



 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      06-02-2004
"Ben" <(E-Mail Removed)> wrote in message
news:uGmvc.2729$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      06-02-2004
"John Saunders" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Ben" <(E-Mail Removed)> wrote in message
> news:uGmvc.2729$(E-Mail Removed)...
> > 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.



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      06-03-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
Quick one - Is SESSION per browser instance or per IP Address? =?Utf-8?B?S01aX3N0YXRl?= ASP .Net 7 04-10-2006 03:38 AM
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class. DJ Dev ASP .Net 3 02-08-2004 04:19 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM



Advertisments