How can I reset the session timeout in a Spring Boot application - spring-boot

I have set the session timeout to 20 minutes by adding the following line to my application.properties file:
server.servlet.session.cookie.max-age=20m
The problem is that my application is a single page application. So even if I use it I never change page and the timeout is never reset. Therefore after 20 minutes I am logged out. I can I tell Spring to reset the timeout after each REST request?

I solved the problem by replacing this line:
server.servlet.session.cookie.max-age=20m
with this line
server.servlet.session.timeout=20m
in the application.properties file.

Related

Session timeout .Net MVC Web config does not work

I have set the web config session timeout to 480 minutes (8hours) I did the same in IIS for the app pool, then for the default website and for my website. Session still times out after 20 minutes, something must be overriding :/
Did anyone have the same problem?
Turns out that I had js script that waited for 20 minutes and then relocated the window to login page...
Obviously I changed the time to longer :)

Session.Timeout not working correctly in ASP Classic / IIS

Recently I created a asp classic web page with which a user can insert his worked hours.
One of the requests was that the page should show a message who is logged in every 10 minutes. The user does his production on a machine and has it's computer besides him, so it is possible that a user will be inactive on the hour web page for 5 - 60 minutes (or even more), yet he will stay on the page nonetheless.
To make the pop up message every 10 minutes I used a timer created in JQuery, this all works fine. Because the total inactive time is not sure, the person wanted the session timeout to be large (24-hours) so that session state (who is logged in) remains for a long time. When a user uses the insert hour web page he is requested to select his username on a different web page and the session("user") is then set.
To accomplish the long session timeout I created a global.asa file in the root with the following code:
<script language="VBScript" runat="Server">
<!-- METADATA
TYPE="typelib"
UUID="00000200-0000-0010-8000-00AA006D2EA4"
-->
Sub Session_OnStart
' Session timeout in minutes (24 hours)
Session.Timeout = 1420
End Sub
</SCRIPT>
Though for some reason (I timed it) the timeout is still the default 20 minutes.. Then I tried to also set the Session.Timeout = 1420 in:
a. The web page of the hours inserting and
b. In the page where the user is selected and the session is being set.
This didn't had any effect though. So then I started researching it and found a similar question on stackoverflow: Session Timeout in Classic ASP website
So this made me look at my IIS settings on the server where I changed a few things.
In the application pool of the website I changed the Regular Time Interval to 0:
Next I also changed the Time-Out to 24 hours in the Session Properties on the Services tab of my website (under Sites):
However this all doesn't have any effect. It still ends the session after 20 minutes (at least it resets my session("user") state.
In the hour inserting web page the session is being checked as follows:
if session("user")="" then
response.redirect("ShowPage.asp?page=SelectUserTimeout")
response.end
end if
So when the session is empty it will redirect to the select a user page where the session("user") will be set again. Though with my time-out settings, if it would actually work, this should only happen after 24 hours and not after 20 minutes.
Any ideas what's going wrong here?
I am using by the way IIS 8.0.
UPDATE
I found the problem! It seems that the Idle Time-Out (Minutes) in the Application Pool of my website was still on the default 20 minutes and for some reason my session.timeout in the asp code didn't override that.
So for anyone facing the same problem I suggest that you go to your Application Pools in IIS --> then go to the application Pool of the website --> go to advanced settings --> Process Model --> and change Idle Time-out
I found the problem myself! It seems that the Idle Time-Out (Minutes) in the Application Pool of my website was still on the default 20 minutes and for some reason my session.timeout in the asp code didn't override that.
So for anyone facing the same problem I suggest that you go to your Application Pools in IIS --> then go to the application Pool of the website --> go to advanced settings --> Process Model --> and change Idle Time-out
In fact the answer posted by the OP is not the solution. I had the same problem and solved configuring the application pool:
Basic Configuration - DO NOT USE .NET CLR. Select No Managed Code.
Pipeline code still Integrated.
Tried on Windows 10 Pro and Windows 2008 server and worked for both.

Session expiring but not logging user out in Laravel 5

I've gone in to the sessions file in the config folder and changed the lifetime = 1 and expire_on_close = false.
I've gone in to the php.ini and commented out session.gc_maxlifetime.
Anything that I put in to the session variable gets wiped out after x amount of minutes that I set in the config file but I'm still not logged out. Am I supposed to create something that logs me out or is Laravel supposed to log me out automatically?

Spring boot session timeout issue after upgrading from 0.5.0.M7 to 1.1.9.RELEASE

I am seeing strange issue after upgrading spring boot from 0.5.0.M7 to 1.1.9.RELEASE.
My application.properties has this property defined
server.session-timeout=60
But now my session gets expired within 1 minute of inactivity. I switch back to previous version and the issue disappears.
I debugged my code to see if ServerProperties.java was setting 60 to sessionTimeout variable inside it. And it indeed did.
Can somebody point me to the direction I should be looking to? What has changed that could cause such an issue?
http://docs.spring.io/spring-boot/docs/1.1.9.RELEASE/reference/htmlsingle/#appendix
The following documentation contains all the properties that you can use in you yml configuration. Here is what it says about the server.session-timeout:
server.session-timeout= # session timeout in seconds
If you want to have 60 minutes timeout then you need to use
server.session-timeout=3600
Hope this helps.

How long will my current session still last?

How can I figure out when my current session will run out?
Is the session timeout updated on every request?
You can find out the answer to the first question by looking in your configuration file in 'app/config/core.php'. It depends on how you've configured your setup. As for the second question, it will update on every page refresh. Config File Info

Resources