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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - Niyo Wong

用于主题检测的临时日志(f89708b9-f679-4391-af74-c92d9138aed4 - 3bfe001a-32de-4114-a6b4-4005b770f6d7) 测试用Word 2007发布博客 【转】ASP.NET Page事件的执行顺序 ASP.NET页面请求过程 JSP 执行过程 SQL Server 2005 错误处理笔记 .Net内存分配笔记 UML入门 与健康有约——送给每一个关心自己身体的人 .net 如何设置和检索特性信息(attribute) VC++(MFC)数据库程序——入门 T-SQL编程基础-游标 .net中的4种事务总结 T-SQL编程基础-基本语法 Javascript调用服务器端事件 ASP.NET菜鸟进阶-Response.Write与RegisterXXX ASP.NET菜鸟进阶-页面间参数传递 差点把这好地儿给荒废了 我们的生活离不开笑
模式窗口页面不更新的问题
Niyo Wong · 2007-08-12 · via 博客园 - Niyo Wong

一次意外发现第二次打开模式窗口时,不能进入if(!Page.Postback),
当时情景是这样的:点击Gatagrid的一行后的update按钮,通过url传两个参数到模式窗口,然后模式窗口在Page_Load 里取参数,读取数据库,初始化页面(在if(!Page.Postback)里)。在模式窗口中修改内容,提交。回到父页面,发现Datagrid的内容已经更新,然后再点update按钮,进入模式窗口,发现模式窗口中显示的内容还是更新之前的内容,查询数据库,数据库记录也已经更新。调试,发现两次url一样(参数一样),第二次打开模式窗口时,if(!Page.Postback)不能进去,恍然大悟,然来是缓存在作怪(因为两次url一样,所以浏览器直接从缓存取)。
解决方案:
1.在Page_Load的if(Page.Postback)上面清除缓存。
增加如下代码:
Response.Cache.SetNoServerCaching();
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(new DateTime(1900,01,01,00,00,00,00));
2.每次点击update按钮时,使每次产生的url不一样。
用于Datagrid每行的key一样,可定每次传的参数一样,也就是url一样,可不可以增加一个参数,每次传一个随机数呢?当然可以。修改后url如下:
Date date = new Date();
string url = "WebForm2.aspx?key1="+ par1 +"&key2="+ par2 +"&flag=" + date;
3.修改浏览器配置。步骤如下:
Tools->Internet Options ->General
在Template Internet files部分选择Setting,在Check for newer versions of stored pages 处选第一个就可以了(默认是Automatically).点击确定就搞定了,当然这是治标不治本的方法,只是告诉大家这样可以临时解决。