4
Contributors
6
Replies
8
Views
7 Years
Discussion Span
Last Post by hirenpatel53
0

You can make use of SessionState propety of Web.config under <System.Web> section.

i.e.

<system.web>  
<sessionState timeout="30"></sessionState>  
</system.web>  

<system.web>
<sessionState timeout="30"></sessionState>
</system.web>
0

try this also

session_start();
if (isset($_SESSION['LAST_REQUEST_TIME'])) {
    if (time() - $_SESSION['LAST_REQUEST_TIME'] > 180) {
        // session timed out, last request is longer than 3 minutes ago
        $_SESSION = array();
        session_destroy();
    }
}
$_SESSION['LAST_REQUEST_TIME'] = time();
0

The idle timeout is based from the last time the server received a request from a client with a given session ID.
You can use Session.Abandon() to force a log off

or for this you can give a trimout for a session in webconfig file for e.g.

<system.web>  
<sessionState timeout="30"></sessionState>  
</system.web>

In above code after 30 minutes Session will be closed . after this perticulaer session redirect user to home page or you can force him to login again.

0

Thank you for your response.

I am new to this. Could you explain in details. where should I place those file like.....

0

you don't need to put this file. Web.config file is already there in root directory. you just need to put the session related code in web.config file under <System.Web> tag.

Thank you for your response.

I am new to this. Could you explain in details. where should I place those file like.....

1

there is web.config file in your application open it and copy code form here and pest in between<System.Web></System.Web>

if got solution dont forgot to mark as solved

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.