While developing web sites it can be annoying that I have to login to the site.
Every time the session runs out I have to go through a flow like…
Open logon page -> enter username/password -> click link to navigate to my page.
I sometimes use Selenium to record this flow, and then automate it.
But Selenium doesn’t work in all browsers, and it still takes
too long to load etc.
I would like to be able to just refresh the page, exactly like I would if the
site didn’t have a login page.
Does anyone use any strategies to achieve this?
Any way to disable login during development?
Or other tools which can help improve the situation?
Why sessions are expiring? Is it because:
-
They were inactive for a certain delay?
In this case, just increase the delay.
-
Or because recompiling the web application threw out application cache and current sessions?
In this case, store sessions on a less volatile support, like the database. This would also give you the advantage to be able to run the web application on multiple servers for redundancy or higher scalability.
In both cases, unless you’re working on a web application of a bank, give to your users the ability to remember credentials on logon through cookies and use it yourself.
While technically, it’s not the same as staying logged in (since the web app will be forced to authenticate the user according to the values in cookies), from the users’ perspective, there is no big difference, since they don’t have to see the login form again for weeks or months.
Rather than disable the login, manually invoke your login procedure on Session start.
For example, in pseudo code, do the following:
protected void Session_Start() {
/* Login */
LoginController.LogUserIn("myUsername", "myPassword");
}
This, of course, holds true only for development systems with development passwords. If you need this for a production system I’d be looking for SSO options.
4
A session has a time limit associated with it. This is set when the session is created. You can set the time limit to a long time for debugging purposes.
A sessionlogouttimer resets when a new page is loaded, set your browser to autoreload the page and your session should not run out.
You can use a meta tag in your page :
(meta http-equiv="refresh" content="3")
or use a plugin for your browser.
Don’t forget to remove the meta tag when you set it live though.