I want the Session to remain Idle until the user logout

Posted by .Netlearner under ASP.NET on 6/21/2012 | Points: 10 | Views : 1377 | Status : [Member] | Replies : 4
Hello All,

Am developing Shopping cart in which payment module is redirected to the third party vendor.While Returning to the page the session is closed.This should not happen unless the user log out the system it should not close the session.How can i do this ?

And i want to set the maximum time duration of the Session to be active in ASP.NET,Whether it can be done and how ?

Thanks in Advance




Responses

Posted by: Johnbhatt on: 6/24/2012 [Member] Starter | Points: 25

Up
0
Down
What is your Session Mode?

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 6/25/2012 [Member] Starter | Points: 25

Up
0
Down
Am Just Using the Simple Session as Follows,

Session["UserName"]="User1";


.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ketvin on: 6/25/2012 [Member] Starter | Points: 25

Up
0
Down
There are a few ways to do this. Here are a couple...

set a session expiry time, such that after a certain amount of time, the session expires and is no longer valid.

set a 'time' flag as session data, and check if their session is still 'new enough' to keep them logged in each pageload.

Code example for option 2:

//on pageload
session_start();

$idletime=60;//after 60 seconds the user gets logged out

if (time()-$_SESSION['timestamp']>$idletime){
session_destroy();
session_unset();
}else{
$_SESSION['timestamp']=time();
}

//on session creation
$_SESSION['timestamp']=time();



.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Johnbhatt on: 6/26/2012 [Member] Starter | Points: 25

Up
0
Down
Increase Session Time in configuration and also Save all your Sessions into Separate Sql Database. So that they can be retrieved in case you need.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response