视图状态是否过期? [英] Does viewstate expire?

查看:132
本文介绍了视图状态是否过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们假设你有一个不依赖于会话的aspx页面,但并依靠视图状态的回发之间的持久性。

Let's say you have a aspx page that does not rely on session, but does rely on viewstate for persistance between postbacks.

如果一个用户访问该页面,并留下了很长的午餐,将视图状态仍然是有效的,当他返回?

If a user is accessing this page, and leaves for a long lunch, will viewstate still be valid when he returns?

推荐答案

没有ViewState是保留作为回发过程的一部分。你可以,但是,覆盖 Page类的SavePageStateToPersistenceMedium()和的LoadPageStateFromPersistenceMedium(),以如果需要实现这些行为。欲了解更多信息,请阅读了解ASP.NET的ViewState

No ViewState is kept as part of the PostBack process. You can, however, override the Page class's SavePageStateToPersistenceMedium() and LoadPageStateFromPersistenceMedium(), to implement that behavior if desired. For more information read Understanding the ASP.NET ViewState.

注意 ViewState是存储在Session所以如果你的会话过期,ViewState中会丢失。我不会说这是ViewState的过期,但肯定的,它会会话超时后销毁。

Note that Page ViewState is stored in the Session so if your Session expires, the ViewState will be lost. I wouldn't say this is ViewState expiring, but yes, it will be destroyed after Session timeout.

这篇关于视图状态是否过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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