I have a web page where i absolutely must keep the user logged in. Here is a cheap and dirty way to keep a user logged into a web site. I created a file called "StillHere.cshtml". Here is its content. Code: @{ Response.AddHeader("Content-type", "text/xml"); } <?xml version="1.0" encoding="utf-8" ?> <still-here> <testing>still</testing> </still-here> then added this javascript to the web page. Code: function AddStillHereInterval() { setInterval("StillHere();", (1000 * 60 * 5)); } function StillHere() { var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "StillHere", true ); xmlHttp.send(null); } Then set the body onload to "AddStillHereInterval();"
I should say that that my web page only works with the Opera browser because of the xpath javascript in it. I never tested the javascript above with IE so it might not work with IE. Someone may have to come up with better javascript that also works in IE. Go for it.
I think you could get some good help on StackOverflow, they have fun with that sort of thing: http://stackoverflow.com/questions/4064159/javascript-setinterval-doesnt-function-properly