【发布时间】:2011-03-15 18:32:23
【问题描述】:
我在我的网站上使用 Masterpage (asp.net webforms),我希望实现一些静态文件的缓存,如 javascript、css 等。
我尝试将以下内容添加到我的 page_load(在母版页中),但是当我使用 Fiddler 时,静态文件仍处于“无缓存”状态。
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));
}
我在这里做错了什么?
// 尼克
【问题讨论】: