protected void Page_Load(object sender, EventArgs e)
{
Application["hello"] = "欢迎学习APPLI对象";
this.TextBox1.Text = this.Application["hello"].ToString();
this.Label1.Text = this.Application["hello"].ToString();
this.Label2.Text = this.Session.SessionID.ToString();
}
我先前的代码如上,IE上的结果是我想要的结果,我把代码改成如下:
protected void Page_Load(object sender, EventArgs e)
{
//Application["hello"] = "欢迎学习APPLI对象";
//this.TextBox1.Text = this.Application["hello"].ToString();
//this.Label1.Text = this.Application["hello"].ToString();
//this.Label2.Text = this.Session.SessionID.ToString();
}
里面的代码全部注释掉,结果输出一样的结果,我问了一下高人,这是为何,回答说是页面缓存 , 难道页面缓存是为了干错误的事情吗.
{
Application["hello"] = "欢迎学习APPLI对象";
this.TextBox1.Text = this.Application["hello"].ToString();
this.Label1.Text = this.Application["hello"].ToString();
this.Label2.Text = this.Session.SessionID.ToString();
}
我先前的代码如上,IE上的结果是我想要的结果,我把代码改成如下:
protected void Page_Load(object sender, EventArgs e)
{
//Application["hello"] = "欢迎学习APPLI对象";
//this.TextBox1.Text = this.Application["hello"].ToString();
//this.Label1.Text = this.Application["hello"].ToString();
//this.Label2.Text = this.Session.SessionID.ToString();
}
里面的代码全部注释掉,结果输出一样的结果,我问了一下高人,这是为何,回答说是页面缓存 , 难道页面缓存是为了干错误的事情吗.
解决方案 »
- 如何根据 System.Environment.OSVersion 来分析用户使用的操作系统
- 自己电脑上运行没有错误,但放到服务器上就出现这个问题。请高手指教
- 如果存储过程是拼的SQL,那么要防止注入,怎么办?
- 控制瀏覽器的問題!!!!!!!!!!!!!!
- 新手的问题
- 很简单的一行代码,为什么总是提示“BC30188: 需要声明”??
- 数据库的问题。
- 如何使IE窗口的菜单栏,工具条等都不显示出来?
- 一个简单问题!!!
- 为什么显示的结果和我想的不一样?
- 如何获取前一页面 ContentPlaceHolder控件里Updatepanel控件里placeholder控件里TextBox的值?
- 此行已从表中移除并且没有任何数据。BeginEdit() 将允许在此行中创建新数据
正常下:
请求->执行代码->生成HTML->返回HTML
页面缓存:
请求->返回HTML
设置一个合适的缓存时间
仅启用客户端缓存,NoCache禁用
Response.Cache.SetCacheability(HttpCacheability.Private);
OutputCache 节点
有的话删掉
{
Application["hello"] = "欢迎学习APPLI对象";
this.TextBox1.Text = this.Application["hello"].ToString();
this.Label1.Text = this.Application["hello"].ToString();
this.Label2.Text = this.Session.SessionID.ToString();
}
保存之后 刷新 或者 重新运行,都可以的,IDE熟不熟悉的问题,用多了就豁然开朗了,都是这么过来的
GOOGLE IDE 可以得到详细的解释