在 GeneXus 应用程序中捕获 ASP.NET 会话超时

发布于 2024-09-28 15:21:24 字数 151 浏览 0 评论 0原文

我需要在 C# 生成的 GeneXus X 应用程序中捕获 ASP.NET 会话 Tiemout。当用户离开键盘超过 N 分钟时,我想再次请求用户/密码,而不会丢失网络表单中数据的更改

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 request User/password once again without loosing data's changes in webform

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-10-05 15:21:24

您应该考虑延长服务器中的会话超时,这样您就不需要首先解决问题。

如果这不是一个选项,您可以创建一个用户控件,通过 ajax 定期检查会话是否处于活动状态,例如使用 JQuery(未测试):

$(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);
    });
} 

其中 CheckSession 是一个 main/http 过程,它执行类似的操作

&httprespone.addstring(&websession.get('userid'))

并且在它是的情况下不,禁用屏幕按钮并以某种方式显示登录表单:

我从未尝试过此操作,但这似乎是可能的。

另一种方法是将会话检查代码附加到提交按钮,这在任何 JavaScript 框架中都应该足够简单。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文