我想缓存在MVC2控制器动作像这样的输出:MVC的OutputCache问题
[OutputCache(Duration = 600, VaryByParam = "id", Location=System.Web.UI.OutputCacheLocation.Server)]
public FileContentResult GetImage(int id) {
}
当用户上传一个新的形象,为自己的图标我用下面的行缓存失效:
HttpResponse.RemoveOutputCacheItem("/MyPage/GetImage/" + u.UserID.ToString());
然而,这似乎并没有工作,我想不通为什么
您的代码看起来正确。你可以验证'u.UserID.ToString()'返回正确的ID吗? – Buildstarted 2010-09-24 13:51:08
是的,它肯定会返回正确的ID – Gazeth 2010-09-28 08:38:44