例子:
<%@ OutputCache Duration="60" %>
就是这个页在缓冲中保存60秒。
下面是利用缓冲的程序页例子
<%@ OutputCache Duration="10" %>
<html>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
TimeMsg.Text = DateTime.Now.ToString();
}
</script>
<body>
<h3><font face="Verdana">Using the Output Cache</font></h3>
<p><i>Last generated on:</i> <asp:label id="TimeMsg" runat="server"/>
</body>
</html>
ASP+页缓存OutputCache Duration用法(指定页面过时时间)
最新推荐文章于 2020-09-26 17:34:45 发布
本文介绍了一个 ASP.NET 中使用输出缓存的具体实例,通过设置页面在缓存中的持续时间为 10 秒来减轻服务器负载并提高网页响应速度。示例展示了如何用 C# 在服务器端设置缓存时间并在页面上显示当前时间。
120

被折叠的 条评论
为什么被折叠?



