如何保持变量存储在会话活动中全天 [英] How Do I Keep Variables Stored In Session Alive For Whole Day

查看:65
本文介绍了如何保持变量存储在会话活动中全天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用会话变量来存储用户名和密码..只要我的网络应用程序在线,即每天将近14个小时,我想要的是存储此会话变量...

我没有使用任何超时机制...会话值会在一定时间间隔后刷新吗?我应该写一个代码来保持会话值活到很长时间???

i have used a session variable to store user name and password.. what i wanted is this session variable to be stored as long as my web application is online i.e. for almost 14 hours a day...
I have not used any timeout mechanism... will the value of session flushed after certain interval?? should i write a code to keep session value alive till long period???

推荐答案

看看他的链接



http://forums.asp.net/t/1283350。 aspx [ ^ ]
check out his link

http://forums.asp.net/t/1283350.aspx[^]


为此您可以使用 HTML5网络存储。



For that you can use HTML5 Web Storage.

引用:

使用HTML5,网页可以在用户的​​浏览器中本地存储数据。早些时候,这是通过cookie完成的。但是,Web存储更安全,更快捷。每个服务器请求都不包含这些数据,但仅在被要求时使用。也可以存储大量数据,而不会影响网站的性能。数据存储在键/值对中,网页只能访问自己存储的数据。

With HTML5, web pages can store data locally within the user's browser.Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for. It is also possible to store large amounts of data, without affecting the website's performance.The data is stored in key/value pairs, and a web page can only access data stored by itself.





在客户端上有两个用于存储数据的新对象:



localStorage - 存储数据时没有到期日

sessionStorage - 存储一个会话的数据



查看此信息以获取更多信息。 HTML5网络存储空间



There are two new objects for storing data on the client:

localStorage - stores data with no expiration date
sessionStorage - stores data for one session

Check this for more info. HTML5 Web Storage


这篇关于如何保持变量存储在会话活动中全天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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