无国籍与否? [英] stateless or not?

查看:75
本文介绍了无国籍与否?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

旧的ASP无国籍。每次你点击服务器它都是从头开始的
。即使HTTP仍然是无状态的,我的理解是ASP.Net通过在客户端的形式中隐藏一个唯一的代码

来解决这个问题,将每个客户端与他们的

服务器内存中的小块。当你发布它的东西时

会自动填充你的文本框等等。


这很方便,但我对此有些困惑br />
服务器端变量。如果我在我的代码中有一个公共int,那么服务器并在一个帖子上将它设置为值为1,不应该是

为1时有一个回发后?为什么int重置为0?

The old ASP was stateless. Every single time you hit the server it was
starting from scratch. Even though HTTP is still stateless, it is my
understanding that ASP.Net solves this problem by hiding a unique code
inside the form of the client, associating each client with their
little block in memory on the server. When you post something it
automatically fills your text boxes back up, etc.

This is very convenient, but I''m having some confusion about
server-side variables. If I have a public int inside my code back on
the server and set it to a value of 1 on one post, shouldn''t it still
be 1 when there is a post-back? Why is the int reseting to 0?

推荐答案

asp.net就像asp一样无状态并且像asp一样支持会话。 />
差别不大。


- 布鲁斯(sqlwork.com)


< ta **** *****@gmail.com>在消息中写道

新闻:11 ********************** @ z14g2000cwz.googlegr oups.com ...

|旧ASP是无国籍的。每次你点击服务器都是

|从头开始。尽管HTTP仍然是无状态的,但它是我的

|了解ASP.Net通过隐藏唯一代码来解决这个问题

|在客户的形式内,将每个客户与他们的

|相关联服务器内存中的小块。当你发布它的东西

|自动填写你的文本框等等。

|

|这很方便,但我对

|有些困惑服务器端变量。如果我的代码中有一个公共int,请回到

|服务器并在一个帖子上将其设置为值1,不应该还是

|有回传后是1吗?为什么int重置为0?

|
asp.net is stateless just like asp and supports session just like asp.
there is little difference.

-- bruce (sqlwork.com)

<ta*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
| The old ASP was stateless. Every single time you hit the server it was
| starting from scratch. Even though HTTP is still stateless, it is my
| understanding that ASP.Net solves this problem by hiding a unique code
| inside the form of the client, associating each client with their
| little block in memory on the server. When you post something it
| automatically fills your text boxes back up, etc.
|
| This is very convenient, but I''m having some confusion about
| server-side variables. If I have a public int inside my code back on
| the server and set it to a value of 1 on one post, shouldn''t it still
| be 1 when there is a post-back? Why is the int reseting to 0?
|


好的,我要去看看这个但是如果有人看到的话什么东西

错误的我在说什么,插话。


ViewState保存你所说的信息。 ViewState

保留页面缓存和文本框等的值,除非你为该控件设置EnableViewState为false。


但是当你有一个服务器端变量时,它不会成为

ViewState的一部分,因为它不在web表单/页面上。这是服务器端。所以你

必须存储在某个地方,如cookie或会话。


希望这会有所帮助,

Phillip


" ta ********* @ gmail.com"写道:
Okay, I''m going to take a shot at this but if anyone else sees something
wrong with what I''m saying, chime in.

The ViewState holds the information that you''re speaking about. ViewState
keeps a cache of the page and the values for your textboxes and etc unless
you set the EnableViewState to false for that control.

But when you have a server-side variable, that wouldn''t be part of the
ViewState because it''s not on the web form/page. It''s server side. So you
would have to store that somewhere like a cookie or in Session.

Hope this helps,
Phillip

"ta*********@gmail.com" wrote:
旧的ASP是无状态的。每次你点击服务器它都是从头开始的。即使HTTP仍然是无状态的,我的理解是ASP.Net通过在客户端的形式中隐藏一个唯一的代码来解决这个问题,将每个客户端与他们的
小块相关联。服务器上的内存。当你发布一些东西时它会自动填充你的文本框等等。

这很方便,但我对服务器端变量有些困惑。如果我的代码中有一个public int返回到服务器上,并在一个帖子上将其设置为值1,那么当有回传时,它是不是仍然是1?为什么int重置为0?
The old ASP was stateless. Every single time you hit the server it was
starting from scratch. Even though HTTP is still stateless, it is my
understanding that ASP.Net solves this problem by hiding a unique code
inside the form of the client, associating each client with their
little block in memory on the server. When you post something it
automatically fills your text boxes back up, etc.

This is very convenient, but I''m having some confusion about
server-side variables. If I have a public int inside my code back on
the server and set it to a value of 1 on one post, shouldn''t it still
be 1 when there is a post-back? Why is the int reseting to 0?



Web是无状态的,ASP.NET不会改变这个事实,它只是隐藏它。


每当有人请求你的一个页面时,必须从头开始创建

并从头开始重新处理(这就是为什么我们

有一个page_load事件)。在服务器完成页面处理后,您可能正在设置的任何变量都会被销毁




您正在谈论的数据(文本框值等) )通过名为ViewState的隐藏表单字段在页面调用之间持续

。信息

未存储在服务器的内存中。


< ta ********* @ gmail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...
The web is stateless, ASP.NET does not change that fact, it just hides it.

Each and every time someone requests one of your pages, it must be created
from scratch and processed from the start all over again (which is why we
have a page_load event). Any variables you may be setting are destroyed
immediately after the server finishes processing the page.

The data that you are talking about (textbox values, etc.) is persisted
between page calls by a hidden form field called ViewState. The information
is not being stored in memory on the server.

<ta*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
旧的ASP是无国籍的。每次你点击服务器它都是从头开始的。即使HTTP仍然是无状态的,我的理解是ASP.Net通过在客户端的形式中隐藏一个唯一的代码来解决这个问题,将每个客户端与他们的
小块相关联。服务器上的内存。当你发布一些东西时它会自动填充你的文本框等等。

这很方便,但我对服务器端变量有些困惑。如果我的代码中有一个public int返回到服务器上,并在一个帖子上将其设置为值1,那么当有回传时,它是不是仍然是1?为什么int重置为0?
The old ASP was stateless. Every single time you hit the server it was
starting from scratch. Even though HTTP is still stateless, it is my
understanding that ASP.Net solves this problem by hiding a unique code
inside the form of the client, associating each client with their
little block in memory on the server. When you post something it
automatically fills your text boxes back up, etc.

This is very convenient, but I''m having some confusion about
server-side variables. If I have a public int inside my code back on
the server and set it to a value of 1 on one post, shouldn''t it still
be 1 when there is a post-back? Why is the int reseting to 0?



这篇关于无国籍与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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