哪个是更好的Cookie或会话 [英] Which is better Cookies or Sessions

查看:81
本文介绍了哪个是更好的Cookie或会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net应用程序中使用会话或cookie的更好做法.

Which is better practice to use session or cookies in your asp.net application.

推荐答案

这不是更好"还是更糟"的问题它们用于不同的目的.

会话变量存储在服务器上,并且永远不会离开服务器计算机. Cookies存储在客户端,每次服务器需要它们时都必须进行往返.

这意味着会话变量会在会话结束时过期(默认情况下大约为十分钟),而cookie几乎可以无限期地在客户端上维护-这可能是一件好事(如果是购物篮)或一件坏事(如果它是购物篮) "是密码".
It''s not a question of "better" or "worse" they are used for different purposes.

Session variables are stored at the server, and never leave the server computer. Cookies are stored at the client, and have to make a round trip each time the server wants them.

Which means that session variables expire when the session does (about ten minutes by default) whereas cookies can be maintained almost indefinitely on the client - which may be a good thing (if it''s a shopping basket) or a bad thing (if it''s a password).


http://php.about.com/od/learnphp/qt/session_cookie.htm [ ^ ]
http://forums.devshed.com/asp-programming-51/session-or-cookie-which-is-better-79383.html[^]
http://php.about.com/od/learnphp/qt/session_cookie.htm[^]


这篇关于哪个是更好的Cookie或会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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