Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all i have seen several examples regarding the session. But i would like to know whether the following work as per my requirement or not. My requirement i will have some pages that user can access. If user visits a page and if he didn't perform any operations for 5 minutes or so i would like to redirect him to the default page available. I have referred the following article Alert Session Time out in ASP.NET[^]

But this shows the session expiration even when i am working on the page. I would like to impllement some thing like net banking application, when user is inactive for few minutes i would like say your session has been expired and redirect him to the login page any idea please
Posted

When User click on Logout button,
in that button click event
clear all cookies and write
session.abandon();


In web.config write below tag in
<system.web> tag
<sessionstate timeout="60" /></system.web>


If you are using forms authentication then you can set
slidingExpiration
property of forms tag to
"true"


Please go through these links

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.slidingexpiration.aspx[^]

http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx[^]
 
Share this answer
 
v4
Comments
demouser743 26-Sep-11 6:13am    
I am not asking about the user clicking on Log out button. Read the question carefully, i would like to end the session if the user is inactive for certain amount of time
P.Salini 26-Sep-11 6:15am    
Ok in web.config specify sessiontimeout as below
specify the timeout in minutes
<sessionstate timeout="60">
demouser743 26-Sep-11 6:17am    
But as per the given link if i do exactly even if i am active on the form session is expiring, i don't want to do so
P.Salini 26-Sep-11 6:19am    
r u using windows authentication or forms
demouser743 26-Sep-11 6:22am    
Form authentication
Hi,


you've to follow some process for it.

Let me tell you how I did in my client chat app

First I created session variable with 3 min timeout

then in my javascript i've one method to post data from client to server in every
1 min

In my server side i've one method to handle that asyncronous request to extend timout of session variable.

In this process the server method invoked by client javascript in every 1 min
If not that means the client is no active then the session is automatically
cleared when its timeout time overs

By this process I achieve my chat app in client website.

Here I just said example timings for explanation

you can set timeouts of session variables As your requirement

I hope you understood What I said

All the Best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900