2

How does sessions work in a server?

Is it correct that after closing the browser and re-opening intermediately the sessions be restored? What about closing and re-opening a tab (where the session would be the same)?

Is it correct that different browsers from the same client have different sessions? Even private mode of browser has different sessions that "regular mode"!

I know this are lots of questions. I'd like some good source to read about how do sessions work so I can answer the other question myself. (Still if anyone has something to say about the others question I'll also be grateful.

1
  • 1
    Closing. Either an end user question (superuser.com) or a programming related question (stackoverflow.com), but whatever it is - serverfault.com is not a dump for questions not related to server administration.
    – TomTom
    Dec 13, 2010 at 16:31

2 Answers 2

1

depends how the cookie is setup. Most sessions are tied to a cookie that is on your computer. The cookie can have a lifetime of minutes to days or just the lifetime of the browser. I think if you close a tab that counts as the lifetime of the browser.

http://www.ruturaj.net/tutorials/php/how-sessions-work

http://computer.howstuffworks.com/cookie1.htm

2
  • @Mike - Can you please post a link so I can read some more about it the "cookies on the computer". Right now closing a tab does not kill the cookies (at least with the site I'm trying). Thanks for the answer!
    – Diego
    Dec 13, 2010 at 13:47
  • They probably set a certain lifetime for the cookie
    – Mike
    Dec 13, 2010 at 13:49
0

Server sessions are managed by the web server. Session state is used for storing the user's object state, so you can request the server without having to login every-time (if your web application requires authentication). Storing objects in the server between callings, from client to server is used some times for passing data between pages. Session state is one of the scopes the server has for storing object in memory: request, page, session, application.

In ASP.Net session state depends on which mode your application is running: in process mode, out of process mode, sql server mode.

Because the dis-connected state nature of web applications there is required some manner for maintaining the Session ID, this is where cookies are used. In ASP.Net you can use cookie-less state, in this case the session ID is transfered in the URL each time you do a request to the server. Every cookie has an expiration time. In ASP.net all this configuration take place in some XML file named web.config.

http://msdn.microsoft.com/en-us/library/ms972429.aspx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .