我在后台写了个方法
大概如下
DataSet ds= new DataSet();
[Ajax.AjaxMethod()]
public DataSet GetInfoFromEmployee()
{
if(Cache["test"]==null)
{
Cache["test"]==ds;
return ds;
}
else
{
ds=(DataSet)Cache["test"];
return ds;
}
}
就是想利用Cache缓存数据,但是ajax调用了这个方法,就是不走这个方法,纳闷,请高手解释清楚原因!
大概如下
DataSet ds= new DataSet();
[Ajax.AjaxMethod()]
public DataSet GetInfoFromEmployee()
{
if(Cache["test"]==null)
{
Cache["test"]==ds;
return ds;
}
else
{
ds=(DataSet)Cache["test"];
return ds;
}
}
就是想利用Cache缓存数据,但是ajax调用了这个方法,就是不走这个方法,纳闷,请高手解释清楚原因!
<%@ OutputCache Duration="300" VaryByParam="none" %>
或者这么说该类库使用过程中,你需要重新编译引用。
然后这个cache的引用貌似是这个: System.Web.Caching.Cache
而直接写Cache的话,你看它的命名空间是Page.Cache啊!
这跟cache有什么关联?
{
if(Cache["test"]==null)
{
Cache["test"]==ds;
return ds;
}
else
{
ds=(DataSet)Cache["test"];
return ds;
}
} 这个只是不用Ajax.AjaxMethod的表示,就可以用了,ajax对这个有什么影响呢 能给解释吗 谢谢了