如何在asp .net中将到期超时时间增加到2-3小时 [英] How to increase expiry timeout to 2-3 hrs in asp .net
本文介绍了如何在asp .net中将到期超时时间增加到2-3小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp .net中增加到期超时2-3小时
How to increase expiry timeout to 2-3 hrs in asp .net
推荐答案
阅读本文: http://www.dotnetperls.com/cache [ ^ ]
using System;
using System.Web.UI;
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Set this ASPX response to expire in one year.
// ... This is essentially 'never'.
Response.Cache.SetExpires(DateTime.Now.AddYears(1));
}
}
Page that uses Response.Cache and Cache-Control: C#
using System;
using System.Web;
using System.Web.UI;
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Set cache for 1 hour on all computers and servers.
// ... Proxies, browsers, and your server will cache it.
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetMaxAge(new TimeSpan(1, 0, 0));
}
}
这篇关于如何在asp .net中将到期超时时间增加到2-3小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文