Capture ASP.NET Session Timeout in a GeneXus Application
I need to capture an ASP.NET Session Tiemout in a GeneXus X application generated in C#. When a user stay away from keyboard more than N minutes, I would like to reque开发者_开发问答st User/password once again without loosing data's changes in webform
You should consider just extending the session timeout in the server, that way you wont need to solve the problem in the first place.
If that's not an option you could make a user control that checks periodically if the session is active via ajax, example with JQuery (not tested):
$(function() {
setInterval(CheckSession, 10000); /*10 seconds*/
});
function CheckSession() {
$.get("/CheckSession.aspx", function(data) {
$("body").append("<p>" + data + "<p/>"); /*shows current user*/
if(data = "")
$("#loginform").fadein(200);
});
}
Where the CheckSession is a main/http proc that does something like
&httprespone.addstring(&websession.get('userid'))
And in the case that it is not, disable the screen buttons and somehow show the login form:
I've never tried this, but it seems possible.
An alternative would be to attach the session checking code to the submit button, should be simple enough in any javascript framework.
精彩评论