使用很简单<%@ OutPutCache Duration="60" VaryByParam="none"%>
Duration:缓存时间
VaryByParam:通过参数来更新缓存的内容
还有其他的一些属性
CacheProfile:调用WebConfig中的缓存时间
例如:WebCofig中
实现代码如下:
<system.web>
<outputCacheSetting>
<outputCacheProfiles>
<add name="cacheTest" duration="50"/>
<outputCacheProfiles>
</outputCahceSetting>
</system.web>
在页面中声明
<%@ OutputCache CacheProfile="cacheTest" VaryByParam="none"%>
VaryByControl:通过控件来改变缓存
<%@OutputCache Duration="60" VaryByParam="none" VaryByControl="Button1"%>
以上就是【asp.net 页面输出缓存】的全部内容了,欢迎留言评论进行交流!