惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
F
Full Disclosure
A
About on SuperTechFans
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
Know Your Adversary
Know Your Adversary
K
Kaspersky official blog
L
LINUX DO - 热门话题
Recorded Future
Recorded Future
C
Cisco Blogs
M
MIT News - Artificial intelligence
T
Tenable Blog
G
GRAHAM CLULEY
月光博客
月光博客
Recent Announcements
Recent Announcements
V
Visual Studio Blog
IT之家
IT之家
T
The Exploit Database - CXSecurity.com
The GitHub Blog
The GitHub Blog
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
P
Privacy International News Feed
P
Proofpoint News Feed
I
Intezer
博客园 - 叶小钗
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
小众软件
小众软件
Hacker News - Newest:
Hacker News - Newest: "LLM"
O
OpenAI News
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
The Cloudflare Blog
Spread Privacy
Spread Privacy
酷 壳 – CoolShell
酷 壳 – CoolShell
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
B
Blog RSS Feed

博客园 - andy.wu

聊聊除了生产率之外的东西,比如赚钱效率 一次思维锻炼,使用拼音模糊匹配中文 - andy.wu - 博客园 一些需要解决的问题(Win32) svn howto: svn合并时报错:retrieval of mergeinfo unsupported by 。 Windows Mobile应用开发(1):使用Win32 SDK 开发屏幕手电程序 vs(2005 and 2008)中使用vc++创建智能设备项目失败的正确解决方案 思考:google的opensocial的实现原理 思考:日期类型的数据应该用什么样的具体形式存储到数据库? google got crazy!!! NHibernate Tips: 要注意模型与数据库在Null方面的匹配 AjaxPro基础知识 and FAQ 在iis 6中使用共享目录作为虚拟目录 初学wpf感想 Sql Server 2005全文检索中碰到的问题和分析 asp.net faq: 在html文件中,用js获取session? 给博客园首页管理的建议 china-pub,当当,卓越购书经验谈 使用Emacs代替Windows下的Command shell 经验:使用.net 2.0中的TransactionScope碰到的问题
EnableViewState详细分析 - andy.wu - 博客园
andy.wu · 2008-12-01 · via 博客园 - andy.wu

ASP.NET中,很多地方可以设置EnableViewState,本文主要说明一下在不同位置设置EnableViewState的效果。

1. 在web.config中

在page小节中设置,比如:

<pages enableViewState="false">
 这样的设置后,所有没有明确指定EnableViewState的控件,都会使用在web.config中指定的值。

2. 在MasterPage中

当在MasterPage中EnableViewState=false时,表示禁用了使用该MasterPage的页面的视图状态信息,包括所有控件,即使页面或控件明确指定EnableViewState=true。

3. 在Page中

当在Page中EnableViewState=false时,表示禁用了该Page的页面的视图状态信息,包括所有控件,即使控件明确指定EnableViewState=true。

4. 在UserControl中

当在UserControl中EnableViewState=false时,表示禁用了该UserControl的视图状态信息,包括所有控件,即使控件明确指定EnableViewState=true。

5. 在控件中

当在控件中EnableViewState=false时,表示禁用了该控件的视图状态信息。

注:如果要确保某个控件使用视图状态,可以在该控件的OnInit事件中,指定该控件的父控件和Page使用视图状态。

我通常的做法:

在web.config中禁用视图状态,当需要启用时再明确指定。