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

推荐订阅源

D
DataBreaches.Net
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Y
Y Combinator Blog
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
MyScale Blog
MyScale Blog
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
量子位
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
C
Cybersecurity and Infrastructure Security Agency CISA
L
Lohrmann on Cybersecurity
L
LINUX DO - 最新话题
The Register - Security
The Register - Security
T
Tailwind CSS Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
S
Secure Thoughts
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
L
LangChain Blog
Recorded Future
Recorded Future
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Tor Project blog
人人都是产品经理
人人都是产品经理
F
Full Disclosure
O
OpenAI News
Webroot Blog
Webroot Blog
A
Arctic Wolf
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
B
Blog RSS Feed
Vercel News
Vercel News

博客园 - 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中禁用视图状态,当需要启用时再明确指定。