0

hi,
can i change the sessions for a website by my own on my conditions , like if i wanna close the session if the user haven't done any work for a specified time and keeps reopening the sessions for active users ?

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by ayat abukhadra
1

In the global.asax file there is a session_end function which is called when the timeout period for the website is reached. You can use that to alter any session variables or to clear them out completely if a user has been inactive.

1

I believe the default timeout for session is 20 minutes, but you can modify that in your web.config if you need to specify a different time span. Also, a note on hericles suggestion, the session_end event is available when using InProc session storage. This is the default option so unless you've specified a different type of session storage, such as state server or sql server, this is what you're using.

0

thanks for replying but may I ask how to know if a user still active and opens the session if he is and close it if he is not , does property IsOnline works in this case ?

1

The ASP.NET Membership service supports this feature. To get the particular user's last activity date, use LastActivityDate property and to indicate whether the user is online or not use IsOnline property.

You can only use the property to check user is online or not. If user performs an action then you can check his status and do actions accordingly.

This question has already been answered. 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.