Html5 sessionStorage 通过服务器会话?
我不明白哪个是会话控制的最佳选择。
我知道出于安全原因,用户/密码/登录名必须存储在服务器会话中,但是我想存储的其他内容是什么?
如果我在服务器存储中有数据,那么当在服务器端组装html时,php/python/c#/java将填充会话数据,而当我使用html5 sessionStorage时,它将由javascript填充存储的数据。我想了解为什么以及何时应该使用 sessionStorage 而不是服务器会话。有人可以帮我吗?
I don't understand which is the best option for session control.
I know user/password/login must be stored at server session by security reasons, but and the other things I want to storage?
If I have data at server storage when html is assembled at the server-side php/python/c#/java will fill the session data, and when I'm using html5 sessionStorage, it will be javascript that will fill the stored data. I want to understand why and when I should use sessionStorage over server session. Can someone help me with that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,使用服务器存储来处理所有重要的事情。会话存储尚未得到足够广泛的支持,无法将其用于关键功能。
其次,您需要存储您不希望用户了解或能够在服务器端更改的任何信息。用户端的任何信息都可能被欺骗和更改,因此请记住这一点。所有重要的值都需要经过验证。
最后,sessionStorage 对于很多事情来说都很棒,但我认为它们的主要功能是它将能够与 AJAX Web 应用程序一起使用,以允许客户端处理信息。您可以发送一次并将其保留在那里,而不是来回发送大量数据。减少服务器上的用户占用空间,尤其是对于复杂的程序。
也就是说,我会重申,目前仅将其用于对站点/应用程序的运行不重要的附加功能。
First off, use server storage for everything vital. Session storage is not yet widely supported enough to be able to use it for key features.
Secondly, you'll want to store any information you don't want the user to know about or be able to change on the server side. Any information on the user side is subject to spoofing and changing, so keep that in mind. All important values would need to be validated.
Finally, sessionStorage will be great for a lot of things, but I think they main big feature is it will be able to be used with AJAX web-apps to allow for client side processing of information. Instead of sending back and forth a lot of data, you can send it once and keep it there. Reduces a users footprint on your server, especially for complicated programs.
That said, I'll reiterate that, for now, only use it for additive features that are non-vital to the running of your site/app.