Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Good Day !!

How r u my friends,

I have one doubt and am unable to solve this Problem.

I have a WEB APPLICATION in ASP.NET, C#, SQL-Server.
Suppose if the User Logged into that application and he is not active and not accessing that application. after some time it should be back to login page.

Note: if the user is Un Active, it should be Back to Login Page. again the user should enter username and password to access.

Please help me this issue.

Thanks.
Posted
Comments
RDBurmon 13-Jun-12 9:28am    
Thanks Everyone who replied to this thread , So Ubaid, I think you have got enough responses and you should be able to mark it as your answer and close the thread. Please do so.

Hi,

As per my knowledge you can do it using session validation. If you are using session validation then you don't need to worry about it. Just set the timeout limit. This limit states that if a user is being inactive for a certain time the session will expire and user will have to key in userid and password again to access the information.

--AK
 
Share this answer
 
1. You need to set the session timeout value.
if the user is inactive for this much time and after that he try to access he will be pushed to home page or logged out page since session has already expired.

BUT, this will not throw the user to home page automatically on session timeout. to do that:

1. you need to have a common site wide javascript file.
2. whenever user logs in you have to start a timer that is equal to session timout.
3. reset this timer on every postback.
4. if the user is idle for this much time then this timer expires then do a postback to the server(perhap on same page) and hopefully by this time the session must have already expired he will be pushed to homepage.logout page.[or you can kill the session if this timer fires and redirect him to home page, your choice]
 
Share this answer
 
v2
Comments
[no name] 13-Jun-12 3:04am    
Good Idea. But don't you think maintaining timer for entire application will be quite irrespective.?
Hello,

Really no website is redirected to login page automatically when the user idle for more time.

The best possible is set the session Timeout value in web.config.The default timeout is 20 Minutes.You can set this value as per your requirement.

During login,put some flag or UserID into session.Check this flag or UserID of session is null in the Application_PreRequestHandlerExecute event in Global.asax file.

For every hit this event is triggered and also due to checking of session we can identify the the user is active or not.

Based on it you can redirtect to home page.
 
Share this answer
 
just provide time to expire session.

if time expires redirect to login page else redirect to same page.

This sets timeout session attribute to 30 minutes use the following in your Web.config file inside <system web=""> .

<sessionstate>
mode="InProc"
cookieless="true"
timeout="30" />
 
Share this answer
 
Hey dude,

Really no website is redirected to login page automatically when the user idle for more time.

The best possible is set the session Timeout value in web.config.The default timeout is 20 Minutes.You can set this value as per your requirement.

During login,put some flag or UserID into session.Check this flag or UserID of session is null in the Application_PreRequestHandlerExecute event in Global.asax file.

For every hit this event is triggered and also due to checking of session we can identify the the user is active or not.

Based on it you can redirtect to home page.

Thanks
Mani
 
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