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

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

博客园 - cdboy

.Net8新特性 EF Core 中原生SQL、存储过程、视图的使用 EF Core DBFirst 和Code First小结 软件自动发布自动化之配置文件修改 Logstash日志搜集 Windows Service插件服务开源 Linq通用分页数据查询方法 .Net 通用配置文件读取方法 Asp.net 主题中CSS文件的缓存问题 RssTookit使用小结 Windows Live Writer 分享到插件 Windows Resx资源文件编辑工具 IIS 7 中设置文件上传大小限制设置方法 多语言资源文件帮助 转帖:正则表达式的与或非 vs2010使用PostSharp 1.5 window service 插件服务插件开发 插件式服务架构 多语言资源工具之制作类库资源文件
Asp .net 4.0 中ViewStatus 使用
cdboy · 2012-06-16 · via 博客园 - cdboy

asp .net 4.0程序配置,默认是启用ViewState的,全局中禁用使用如下配置:

image

同时这个配置可以在不同的目录中进行重新设置配置。

如果要在禁用的目录中,部分页面要启用ViewState,在启用的页面中,加入如下配置:

image

其中“ViewStateMode”有如下三个值:

Inherit:

视图状态从父控件继承;

Enabled:

即使父控件的视图状态没有启用,也启用该控件的视图状态;

Disabled:

即使父控件的视图状态启用了,也禁用此控件的视图状态。

下面进行一些实际的测试(在配置中默认禁用视图):

1、配置如下:

image

页面的视图内容如下所示:

image

2、在页面中启用视图状态:

在页面启用视图:

image

另外,如果此页面有MasterPageFile,就要在此页面中也要启用视图状态:

image

只有设置上述过程后,才能启用页面的视力状态,浏览页面视图内容如下:

image

当前页面中,还有一个用户控件,视图状态,还是没有启用,如果要进行启用,必须在控件中设置如下:

image

现在浏览页面,视图内容如下:

image

必须按照上述过程,才能启用视图状态,上面最容易出错的地方就是在masterpage页面时,容易忽略设置启用视图状态