刚开始学ASP.NET的缓存技术,在做整页缓存的一个简单应用时碰到一个问题:在IE中运行后,单击页面内的“刷新”按钮时,第一次可以显示时间,然后在5秒内如果再次单击“刷新”按钮则浏览器提示无法显示该网页,而5秒之外再次单击一次则可以正常显示,之后再次在5秒内单击又无法显示,可是在北大青鸟的教材书上说的是可以一直不停的单击“刷新”按钮进而观察缓存效果。
这个问题在火狐浏览器中不存在,可以不停的单击“刷新”按钮,每5秒更新一次时间。
请问在IE中为啥存在这个问题?前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WholePageCache.aspx.cs" Inherits="MyCacheExample_WholePageCache" %><%@ OutputCache Duration="5" VaryByParam="none" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
当前系统时间:<asp:Label ID="lblTime" runat="server"></asp:Label><br /><br />
<asp:Button ID="btnRefresh" runat="server" Text="刷新" onclick="btnRefresh_Click" />
</div>
</form>
</body>
</html>
后台代码:
public partial class MyCacheExample_WholePageCache : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
this.lblTime.Text = DateTime.Now.ToString();
}
}
这个问题在火狐浏览器中不存在,可以不停的单击“刷新”按钮,每5秒更新一次时间。
请问在IE中为啥存在这个问题?前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WholePageCache.aspx.cs" Inherits="MyCacheExample_WholePageCache" %><%@ OutputCache Duration="5" VaryByParam="none" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
当前系统时间:<asp:Label ID="lblTime" runat="server"></asp:Label><br /><br />
<asp:Button ID="btnRefresh" runat="server" Text="刷新" onclick="btnRefresh_Click" />
</div>
</form>
</body>
</html>
后台代码:
public partial class MyCacheExample_WholePageCache : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
this.lblTime.Text = DateTime.Now.ToString();
}
}
解决方案 »
- 同一个网站部分页面报错 :找不到DNS!!!
- Gridview控件, 能不能在没有数据源的时候也显示出来,
- 在Page_Load中,可以定义页面的控件如Label的TEXT属性吗?
- 提问,帮帮我!新手问题
- C# ASP.NET 2.0开发,熟悉 SQL SERVER 2000,网站开发,在上海月薪大概多少?
- 有关DATAGRID导入EXCEL中?(webform)
- 我的程序中总是出现这个错误: “未定义类型“SQLConnection””
- 初级问题:在DataGrid中添加了checkBox后如何在提交时知道哪条被选中?
- 奇怪!为什么PreviousPage值为null
- 关于动态生成自定义控件。
- 装VS2008后,是不是还要装VS2008 SP1 的补丁 吗?
- asp.net开发中的“Microsoft JScript 运行时错误: 'checkvalue' 未定义”错误提示是什么意思啊?
<script type="text/javascript">
function donghai() {
parent.main.location.reload();
}
setInterval("donghai()",30000)
</script>
不过还是谢谢你了啊!