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

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - 网风

ASP.NET Forums技术研究 关于触发器:在Sql2000中获取针对一个数据库的所有触发器 Sql2000中的规则具体怎么样使用 Sql2000中的角色与用户之间的处理关系 Sql2000中事务处理之事务保存点与嵌套事务 case的深入用法 在游标中进行事务的处理 Sql2000中的分布式事务 使用临时表与声明一个表数据类型的变量有什么区别 Oracle9i安装问题系列 蜘蛛程序参考资料 使用全局唯一标识(GUID) .net的体系结构运用到系统上 经验谈一 Codesmith模板开发 Sql技巧集 项目体系结构 本周研究主题--.net企业库使用 本周技术主题-----.net中的资源文件
同一个页面同时多次保存的解决方案
网风 · 2006-06-02 · via 博客园 - 网风

习惯的解决方法是存储Session的ID和当提交时ViewState中存储的SessionID相比较来防止用户刷新屏屏幕。前提你的程序中允许了自动回发,如果不是的话,就得在hidden field存储这个变量了。下面给出一个典型的例子。在Page_Load事件中你存储了第一次提交时的SessionID和一个时间戳。
protected System.Web.UI.WebControls.Button SubmitButton;

protected System.Web.UI.WebControls.Label RefreshID;     

private void Page_Load(object sender, System.EventArgs e)

{
     if (RefreshID.Text.Length == 0) 
    {
            RefreshID.Text = Session.SessionID+DateTime.Now.Ticks.ToString();
      }
}
 

private void Button1_Click(object sender, System.EventArgs e)

{
      string sesToken = (string) Session[FrameworkConst.SYNC_CONTROL_KEYWORD];      string pageToken = RefreshID.Text;
      if (sesToken != null && sesToken != pageToken)
      {
            Response.Write("The Refresh was performed after submit.");
     } 
      else
      {
            // do your processing here to avoid Refresh trap
            Response.Write("The processing is done here. Disabling submit
button so that user can not perform multiple submit.");
            Response.Write("But still user can peform Refresh on page.");
      }

      Session[FrameworkConst.SYNC_CONTROL_KEYWORD] =       Session.SessionID+DateTime.Now.Ticks.ToString();
      RefreshID.Text = sesToken;         
      SubmitButton.Enabled = false;