如何在会话过期时保存控件值? [英] How can save the control values when session is expired?

查看:78
本文介绍了如何在会话过期时保存控件值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个要求,例如,当会话过期时,所有用户输入的值应该保存,当同一个用户打开页面时保存的详细信息应显示在相应的控件上。



有没有办法做同样的事情?



提前谢谢..

Hello,

I have a requirement like, when the session is expired, all the user entered values should save and when the same user is opens the page then the saved details should be displayed on the appropriate controls.

Is there any ways to do the same?

Thanks in advance..

推荐答案

客户端页面不知道会话何时到期,所以你不能轻易做到这一点。如果你的代码由于在超时后提交表单而给出问题,那么你可以从帖子中获取表单数据并将其存储在某个地方(可能在他们的新会话中),这样当他们返回页面时,数据会被保留。



或者如果你更担心人们填写表格然后放弃他们的浏览器,那么你可以使用客户端上的计时器来发起草稿保存 每分钟左右通过ajax的形式。



如果你解释你的实际问题是什么会有所帮助,因为客户知道什么时候会议结束了这是一个可行的解决方案,因此您需要寻找替代方案。
The client page doesn't know when\if the session has expired so you can't easily do this. If your code is giving problems because they submit a form after a timeout, then you can grab the form data from the post and store it somewhere (in their new Session maybe), so that when they go back to the page the data is kept.

Or if you're more worried about people filling a form out then abandoning their browser, then you can use a timer on the client to instigate a "draft save" of the form via ajax every minute or so.

It'll help if you explain what your actual issue is, as the client knowing when the session has ended isn't a viable solution so you'll need to look for an alternative.


这篇关于如何在会话过期时保存控件值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆