我再一个页面里面往数据库写数据,然后自动转到一个显示页面
显示页面是用datalist空间写的!现在的问题是在前一个页面添加完数据到显示页面的时候没办法得到最新的数据我用的是Response.Redirect转向的!我在显示数据页面里面加了
<META http-equiv="pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache, must-revalidate">
<META http-equiv="expires" content="Mon, 23 Jan 1978 12:52:30 GMT">
也没用
显示页面是用datalist空间写的!现在的问题是在前一个页面添加完数据到显示页面的时候没办法得到最新的数据我用的是Response.Redirect转向的!我在显示数据页面里面加了
<META http-equiv="pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache, must-revalidate">
<META http-equiv="expires" content="Mon, 23 Jan 1978 12:52:30 GMT">
也没用
(2)客户端取消<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</head> (3)服务器具端取消:服务器端:
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
估计是其他的问题,你程序其他有错误的可能性很!
都是用的是
<asp:Label id="label_id" Runat="server"></asp:Label>
这样的服务器控件而且我还发现一个奇怪的现象
在删除的时候如果同事删除多条记录的话
在页面里面总是会留最后一条被删除的记录,但是数据库里面已经没有了,而且刷新一次就好了!用Response.Redirect 重新转向 或者重新绑定数据都是如此 这是为什么啊?奇怪的很啊
或者在页面里面写
<%@ OutputCache Duration="1" VaryByParam="none" %>都没用!每次添加以后都要刷新一边才能出来!痛苦啊!
不ispostback 也试过!我都要哭了!to jxufewbt(我的目标是5星) 能不能看完回复再做答
for( int i=0;i< Cache.Count;i++ ){
IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
string name = CacheEnum.Key.ToString();
if( Cache[ name ] != null ){
Cache.Remove( name );
}
}
<%
Response.Buffer=true;
Response.ExpiresAbsolute=DateTime.Now.AddSeconds(-1);
Response.Expires=0;
Response.CacheControl="no-cache";
%>
可能是这个呀