locked
Keep Session even browser is closed RRS feed

  • Question

  • User-1466065877 posted

    Hi,

    I would like to keep a session to 1 hrs. However, if user closes the browser, the session will be killed. Is there any setting can maintain the session even user close the browser (until 1 hrs end)?

    Sunday, August 30, 2015 9:38 PM

Answers

  • User1992938117 posted

    PhC

    I would like to keep a session to 1 hrs. However, if user closes the browser, the session will be killed. Is there any setting can maintain the session even user close the browser (until 1 hrs end)?

    I don't think its possible to maintain a session even browser is closed, but you have to rethink your requirement and you can save data in cookies which will persist till the expire time.

    https://msdn.microsoft.com/en-us/library/ms178194.aspx 

    http://asp.net-tutorials.com/state/cookies/ 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 31, 2015 12:18 AM

All replies

  • User1992938117 posted

    PhC

    I would like to keep a session to 1 hrs. However, if user closes the browser, the session will be killed. Is there any setting can maintain the session even user close the browser (until 1 hrs end)?

    I don't think its possible to maintain a session even browser is closed, but you have to rethink your requirement and you can save data in cookies which will persist till the expire time.

    https://msdn.microsoft.com/en-us/library/ms178194.aspx 

    http://asp.net-tutorials.com/state/cookies/ 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 31, 2015 12:18 AM
  • User-986267747 posted

    I would like to keep a session to 1 hrs. However, if user closes the browser, the session will be killed. Is there any setting can maintain the session even user close the browser (until 1 hrs end)?

    About this problem, You have to understand what is the session. A session can be defined as a server-side storage of information that is desired to persist throughout the user's interaction with the web site or web application. Instead of storing large and constantly changing information via cookies in the user's browser, only a unique identifier is stored on the client side (called a "session id"). This session id is passed to the web server every time the browser makes an HTTP request (ie a page link or AJAX request). The web application pairs this session id with it's internal database and retrieves the stored variables for use by the requested page. When you close your browser, the cookie("session id") will be cleared, so we couldn't use the session again, because we have lost the session id. About your problem, Persistence session is great way.

    You could refer to http://weblogs.asp.net/imranbaloch/persisting-session-between-different-browser-instances

    Best Regards

    Klein zhang

    Tuesday, September 1, 2015 2:46 AM
  • User-446933086 posted

    I think by keeping the session for 1 if the browser is closed this will be bit hard.

    But yes you can set the cookies and their expire time to 1 hour. Even browser is closed and again open with 1 hour you can retrieve and again establish the session.

    Wednesday, September 2, 2015 6:26 AM