Mar
13
Written by:
Dylan Barber
3/13/2009 8:16 AM
Some users have the wrong idea of why they are forced to log in to a site. Well if you only want to have them log in once and not be logged out while the site is in the browser here is one way. This is above and beyond the 'Remember Login' checkbox and really good for long data entry forms!
The Story
Now I do not normally advocate that site builders/programmers allow users to stay logged in for long periods of time but sometimes you just have to! Normally I would set the timeout for the session to sort of high and hope it catches eveyone who needs to stay logged in and in fact I tried that in this case. No matter how long I set it I kept getting calls that the time was too short. Back to the drawing board!
This is where I cuss under my breath and exclaim '99% of programming is to account for 100% of the stupid users!'
Here was the next solution and this one seems to work in DotNetNuke very well and it should work in most ASP.NET sites as well.
In our instance we wanted this to appear on all pages so we put the code into the Default.aspx. For those DNNers out there this is generally a no no so I created a module out of this solution that can be found here at
Keep Logged In on this site.
What I Did
The code in the module simply places a 1 pixel by 1 pixel transparent graphic at the end of the page and then starts a timer. The timer runs for about 10 minutes and then makes another call to the server to repopulate the image. It works and it doesnt seem to interfere with anything else that I can find yet.