禁用缓存消防福克斯在ASP.NET和C# [英] Disable caching in Fire Fox in ASP.NET and C#

查看:87
本文介绍了禁用缓存消防福克斯在ASP.NET和C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了处理信用卡支付,并在用户,他们收到付款确认页面后点击消防福克斯后退按钮,张贴重复支付的Web应用程序。

I have developed a web application that processes credit card payments and when a user hits the back button in Fire Fox after they received the payment confirmation page, it post a duplicate payment.

我已经把下面的code同时在付款表格和确认页面,它仍然帖子重复付款:

I have put the following code in both the payment form and confirmation page and it still posts duplicate payments:

Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-1));
Response.Cache.SetValidUntilExpires(false);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

我在做什么错了,我怎么能解决这个问题?

What I am doing wrong and how can I resolve it?

推荐答案

重新运行在评论好点。至于这个问题,试试这个code(<一个href=\"http://forums.asp.net/t/1013531.aspx/1?How%20to%20$p$pvent%20browser%20and%20proxy%20caching%20of%20web%20pages\"相对=nofollow>来源):

rerun has a good point in the comments. With regards to this problem, try this code (source):

   Response.ClearHeaders();
   Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
   Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
   Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
   Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
   Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1 
   Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1 
   Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1 
   Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.1 
   Response.AppendHeader("Keep-Alive", "timeout=3, max=993"); // HTTP 1.1 
   Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // HTTP 1.1 

这会迫使所有浏览器以获得最新的版本,而不是页面的缓存版本。 (可能要修改过期的数据的职位是由 2006 )。

这篇关于禁用缓存消防福克斯在ASP.NET和C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆