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 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.
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.
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.
Member
6 Points
96 Posts
Keep Session even browser is closed
Aug 30, 2015 09:38 PM|PhC|LINK
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)?
All-Star
28988 Points
7251 Posts
Re: Keep Session even browser is closed
Aug 31, 2015 12:18 AM|Rajneesh Verma|LINK
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/
www.rajneeshverma.com
Star
8460 Points
1445 Posts
Re: Keep Session even browser is closed
Sep 01, 2015 02:46 AM|Klein Zhang|LINK
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
Member
640 Points
143 Posts
Re: Keep Session even browser is closed
Sep 02, 2015 06:26 AM|idreesbari|LINK
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.