3
컨트롤러 동작이 RedirectResult 결과를 반환 할 때 outputcache 필터가 적용되지 않습니다. 의 Web.config에서OutputCache가 RedirectResult를 캐시하지 않습니다.
: HomeController.cs에서
<system.web>
<caching>
<outputCache enableOutputCache="true"></outputCache>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ShortTime" enabled="true" duration="300" noStore="false" />
</outputCacheProfiles>
</outputCacheSettings>
</caching> ...
:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcOutputCacheRedir.Controllers
{
public class HomeController : Controller
{
[OutputCache(CacheProfile = "ShortTime")]
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
[OutputCache(CacheProfile = "ShortTime")]
public ActionResult About()
{
// Output cache works as expected
// return View();
// Output cache has no effect
return Redirect("Index");
}
}
}
내가 여기
은 ASP.Net MVC3 기본 인터넷 웹 응용 프로그램의 문제를 재현하는 방법입니다 어디서나이 동작을 찾을 수 없습니다 ...이게 정상입니까? 그렇다면 해결 방법은 무엇입니까?
나는 HTTP 내용이 200이나 302 상태 코드 였을 때 더 오래 캐시 될 것으로 기대했다 ... 감사합니다. – 80n