Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

The timeout has been declared like below,

sessionstate timeout="1" mode="InProc"


My requirement is, when the user is not doing any action on the page, then the page should get timeout and redirect to log in page. Else, for each activity the timeout should be refreshed.

Currently the application is working such a way that, the session will be expired, regardless of page alive or not. That means if the page is loaded and after 20 minutes, the page gets time out.

Please advise me for this issue.
Thanks in advance
Posted
Updated 8-Jul-15 1:28am
v3
Comments
Suvendu Shekhar Giri 6-Jul-15 2:47am    
Can you share the respective code block in your web.config? or, where ever you have set the session timeout value?
DPM20 6-Jul-15 3:51am    
Session has already been included in the Web.config,

sessionState timeout="20" mode="InProc"

1 solution

The session is maintained at the server, but dropdowns and textboxes are handled locally by the client: unless the client talks to the server regularly, the session object will time out, even if the user is busy filling in his page. You could make each user action trigger a server event, but that would be rather messy and will slow the client down significantly if you don't do it properly.

Normally, a session timeout is set to around 20 minutes - so if your client is taking longer than this, you might want to extend that: it's not recommended though, as each session object takes resources from the server to maintain.
 
Share this answer
 
Comments
DPM20 6-Jul-15 3:55am    
i have already included the timeout in web.config,
sessionState timeout="20" mode="InProc"

I am wondering if drop down is clicked, values are populating from db, that means it triggers a server side hit. So this action should extend the timeout right?
OriginalGriff 6-Jul-15 4:05am    
Not necessarily: depends how you are doing things.
Are your dropdowns linked in the HTML, or at the server via C#?
DPM20 6-Jul-15 4:07am    
Server side only
OriginalGriff 6-Jul-15 4:29am    
In which case, opening the dropdown won't cause a post back, and the session timeout won't restart.

You might have to consider adding Javascript code to detect user changes and post back just to trigger the reset. (Yeuch!)

But if you have twenty minutes, the user should ok, normally.
How quick is the session timing out?

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