如何在HTML中创建会话 [英] How to creates session in Html
本文介绍了如何在HTML中创建会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个HTML网站.
有人可以提供一些有关如何在html中创建会话的帮助.
或者如果我不想使用任何编程语言(例如asp.net,java等),该怎么办?
I have a website in Html.
can someone provide some assist on how to creates sessions in html.
or what i have to use if i don''t want to use any programming language like asp.net,java etc
推荐答案
据我所知).如果需要在页面之间传递数据,则只能使用HTML的POST或GET方法来完成.
There is nothing like sessions in HTML(as far as i know). if you need to pass data between pages then that can only be done by using POST or GET methods of the HTML.
您无法以与ASP.Net会话状态相同的方式创建会话只是使用html.如果您需要会话类型指针,则可以使用Cookie来确定用户访问了哪个页面/项目等.
更新
建议在会话中使用Cookie.不要在Cookie中存储大量数据.这将导致性能问题,因为每个请求都会导致Cookie与服务器之间来回发送.
大小,数量等也有限制.一个好的帖子如下:
^ ]
Cookies实际上应该只包含非常小的数据点,例如键或令牌,而不是数据集或任何其他重物.
You cant create a session in the same way as ASP.Net session state just using html. If you need session type pointers then you may be able to use a cookie to determin what page / item etc the user has accessed.
Update
Be advised on using cookies for sessions. Do not store large amounts of data in a cookie. This will cause performance issues as each request will cause the cookie to be sent to and from the server.
Also there are limits to size, number etc. A good post is below:
http://superuser.com/questions/97625/what-is-the-maximum-size-of-a-cookie-and-how-many-can-be-stored-in-a-browser-fo[^]
Cookies should really only contain very slight data points such as keys or tokens and NOT datasets or any other heavy object.
您可以使用Cookies进行状态管理.
http://www.w3schools.com/js/js_cookies.asp [
You can use cookies for state management.
http://www.w3schools.com/js/js_cookies.asp[^]
这篇关于如何在HTML中创建会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文