会话和状态有什么区别? [英] what is the difference between session and state?

查看:190
本文介绍了会话和状态有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会话和状态之间有什么区别?

what is the difference between session and state?

推荐答案

会话和状态之间的区别
会话是保持状态的方法之一.


每次将页面发布到服务器时,都会创建一个新的Web页类实例.在传统的Web编程中,这通常意味着与页面和页面上的控件关联的所有信息在每次往返时都会丢失.例如,如果用户在文本框中输入信息,则该信息将在从浏览器或客户端设备到服务器的往返过程中丢失.为克服传统Web编程的固有局限性,ASP.NET包括几个选项,可帮助您在每页和整个应用程序的范围内保存数据.-会话是其中的一种技术.

参考: MSDN:ASP.NET状态管理概述 [
difference between session and state
Session is one of the ways to maintain the state.


A new instance of the Web page class is created each time the page is posted to the server. In traditional Web programming, this would typically mean that all information associated with the page and the controls on the page would be lost with each round trip. For example, if a user enters information into a text box, that information would be lost in the round trip from the browser or client device to the server. To overcome this inherent limitation of traditional Web programming, ASP.NET includes several options that help you preserve data on both a per-page basis and an application-wide basis. - Session is one of the techniques.

Refer: MSDN: ASP.NET State Management Overview[^]


因为您正在询问ASP.NET,我假设您正在谈论会话和会话状态.

HTTP协议是无状态的,这意味着它会将每个请求视为独立的,而无需知道先前对服务器的调用.会话被指定为服务器定义在短时间内将来自同一台计算机的呼叫视为同一组呼叫的一部分的位置.这是一个会话.您可以定义会话的持续时间以及结束会话的条件.

在此会话期间,可以收集变量和其他信息,并使用这些变量和其他信息为用户提供其更改正在对系统进行更改的外观(即使这些更改通常是临时的).这是会话状态.这是会话所处的状态.

这就是为什么会话和状态不是两个主题而是一个主题的原因.这是更多信息的链接:

http://msdn.microsoft.com/en-us/library/ms178581.aspx [ ^ ]
Since you are asking about ASP.NET, I''m going to assume you are talking about sessions and session state.

The HTTP protocol is stateless, meaning that it treats each request as independent, without knowledge of the previous calls to the server. A session is designated as a short period of time that the server defines where calls from the same machine will be treated being part of the same set of calls. This is a session. You can define how long a session is and what criteria will end the session.

During this session, variables and other information can be collected and used to give the user the appearance that their changes are making changes to the system (even though these changes are usually temporary). This is session state. It is the state the session is in.

This is why session and state aren''t really two topics but one topic. Here is a link with more information:

http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]


查看此链接

在ASP .NET中使用会话和应用程序对象 [应用程序状态和应用程序会话之间有什么区别? [ ^ ]

应用程序与会话状态之间的差异. [
Check out this links

Using Session and Application Objects in ASP .NET [^]

What is the difference between Application State and Application Session?[^]

Difference between Application and Session State.[^]


这篇关于会话和状态有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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