为什么查看状态是设计客户端为什么不是服务器端 [英] Why view state is designed client side why not server side

查看:122
本文介绍了为什么查看状态是设计客户端为什么不是服务器端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





任何人都建议我



为什么视图状态被设计为客户端状态管理技术?



i认为http是状态较少的protocal,当postbaks发生时控制损失其状态。几乎所有控制维持视图状态以维持状态。



因为这个原因,视图状态被设计为客户端状态管理技术。



我是否正确?



我们可以维护服务器端也写吗?



i听说有办法从一个表单访问视图状态数据到其他形式?(默认情况下不可能)有什么办法吗?



谢谢你

Hi,

Any one suggest me

Why view state is designed as client side state management technique?

i think http is the state less protocal,when postbaks happens controls losses its state.mostly all controls maintaining view state to maintain state.

for this reason view state is designed as client side state management technique.

am i correct?

can we maintain server side also write?

i heared that there is a way to access the view state data from one form to other form?(by default its not possible) is there any way?

Thank u

推荐答案

Viewstate



Viewstate是ASP.NET页面中的隐藏字段,包含页面上EnableViewstate属性的控件状态是真实的。



您还可以明确添加v其中有一个ASP.NET页面,如:



Viewstate.Add(TotalStudents,87);



如果要在单个页面的不同往返之间保存值,则应使用Viewstate,因为页面的视图状态 无法访问 通过另一个页面。



因为Viewstate使用页面呈现,所以它会消耗带宽,因此请小心地在应用程序中使用它以在低带宽上运行。



查看状态存储在客户端(隐藏字段中的HTML页面)不在服务器上。



Viewstate

Viewstate is a hidden fields in an ASP.NET page, contains state of those controls on a page whose "EnableViewstate" property is "true".

You can also explicitly add values in it, on an ASP.NET page like:

Viewstate.Add( "TotalStudents", "87″ );

Viewstate should be used when you want to save a value between different roundtrips of a single page as viewstate of a page is not accessible by another page.

Because Viewstate renders with the page, it consumes bandwidth, so be careful to use it in applications to be run on low bandwidth.

View state is stored on client side ( HTML page in hidden fields ) not on server.

i heared that there is a way to access the view state data from one form to other form?(by default its not possible) is there any way?





是的,有一种方法,你可以使用

在会话中存储视图状态



Yea there is a way,you can store view state in session by using

<configuration>
    <system.web>
        <browserCaps>
            <case>RequiresControlStateInSession=true</case>
        </browserCaps>
    </system.web>
</configuration>





或在页面上





Or on Page

protected override PageStatePersister PageStatePersister
{
    get
    {
        return new SessionPageStatePersister(this);
    }
}





注意:有关更多信息:ASP.NET客户端状态管理 - ViewSta [< a href =http://blogs.microsoft.co.il/blogs/gilf/archive/2008/05/07/asp-net-client-side-state-management-viewstate.aspxtarget =_ blanktitle =新窗口> ^ ]


你理解正确的东西,我也想添加lil位。客户端状态管理有很多优点。根据视图状态,它的 优点



1)没有服务器资源是必需的:视图状态包含在页面代码中的结构中。



2)简单实现:查看状态不需要任何自定义编程即可使用。它默认打开以维护控件上的状态数据。



3)增强的安全功能:视图状态中的值经过哈希处理,压缩,并为Unicode实现编码,提供比使用隐藏字段更多的安全性。



4)实施:它基于希望他们想要在页面级别或控制级别实现它的开发人员。



像往常一样有一些 缺点 也喜欢,



1)性能注意事项:因为视图状态存储在页面本身中,所以存储大值会导致当用户显示它以及发布它时,页面会变慢。这对于带宽通常有限的移动设备尤为重要。



2)设备限制:移动设备可能没有内存存储大量视图状态数据的能力。



3)潜在的安全风险:视图状态存储在一个或多个中页面上隐藏的字段。虽然视图状态以散列格式存储数据,但它仍然可以被篡改。如果直接查看页面输出源,则可以看到隐藏字段中的信息,从而产生潜在的安全问题。



那么,如何使用它取决于如此多的参数应该根据


$ b来决定$ b - 您希望数据存储的安全性如何?



- 需要存储多少数据?



问候......:笑:
You understand something correct and i also want to add lil bit.There are so many advantage of client side state management. As per as the view state is concerned,its advantages are

1) No server resources are required : The view state is contained in a structure within the page code.

2) Simple implementation : View state does not require any custom programming to use. It is on by default to maintain state data on controls.

3) Enhanced security features : The values in view state are hashed, compressed, and encoded for Unicode implementations, which provides more security than using hidden fields.

4) Implementation : It is based on the wish of developer that they want to implement it at the page level or at control level.

As usual there are some disadvantages also like,

1) Performance considerations : Because the view state is stored in the page itself, storing large values can cause the page to slow down when users display it and when they post it. This is especially relevant for mobile devices, where bandwidth is often a limitation.

2) Device limitations : Mobile devices might not have the memory capacity to store a large amount of view-state data.

3) Potential security risks : The view state is stored in one or more hidden fields on the page. Although view state stores data in a hashed format, it can still be tampered with. The information in the hidden field can be seen if the page output source is viewed directly, creating a potential security issue.

So,how to and where to use it depends on so many parameters which should be decided based on

- How secure you want your data to be stored?

- How much data is there that needs to be stored?

Regards..:laugh:


这里有更详细的介绍。



http://msdn.microsoft.com/en-us/library/bb386448(v=vs .100).aspx [ ^ ]
Here has more detailed introduction .

http://msdn.microsoft.com/en-us/library/bb386448(v=vs.100).aspx[^]


这篇关于为什么查看状态是设计客户端为什么不是服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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