哪个是更好的viewstate或globalvariable [英] Which is better viewstate OR globalvariable

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

问题描述

哪个更好
viewstate或globalvariable

Which is better
viewstate OR globalvariable

推荐答案



请参阅以下链接

http://www.dotnetspider.com/Forum/307599-Difference-between-global-variable-and-View-state-in-net.aspx [ http://www.nullskull.com/q/10352542/difference- between-viewstate-and-global-variable.aspx [ ^ ]
Hi,

refer below links

http://www.dotnetspider.com/forum/307599-Difference-between-global-variable-and-View-state-in-net.aspx[^]

http://www.nullskull.com/q/10352542/difference-between-viewstate-and-global-variable.aspx[^]


ViewState仅用于处理回发请求和结果的单个页面.一旦你
重定向到新页面,ViewState丢失.

静态变量(全局变量)将在页面的所有实例之间共享.因此,如果您同时具有两个aspx用户,则共享值,这不好,我个人建议不要在Web场景中使用静态变量.
ViewState is only used on a single page that handles postbacks request and results. Once you
redirect to the new page, the ViewState is lost.

Static Variable(global variables) will be shared across all instances of the page.Hence if you have two users of same aspx at the same time value is shared which is not good & I personally would suggest never use static variables in a web scenario.


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

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