Я пытаюсь кэшировать ActionResult. В конкретном ActionResult я записываю некоторые данные в файлы cookie. Кэш вывода не работает в этом результате действия. Он отлично работает со всеми другими действиями, где я не использую Response.Cookies. Пожалуйста, помогите мне решить эту проблему.
Я использую ASP.NET MVC 4.
Редактировать
(Код включен)
[OutputCache(Duration = 8000, VaryByParam = "*")]
public ActionResult List(SearchViewModel searchViewModel, int page = 1, int mode = 1)
{
HttpCookie ck = Request.Cookies["Geo"];
string lat = string.IsNullOrEmpty(Request.Params["lat"]) ? null : Request.Params["lat"];
string lng = string.IsNullOrEmpty(Request.Params["lng"]) ? null : Request.Params["lng"];
if (ck == null)
{
ck = new HttpCookie("Geo");
Response.Cookies.Add(ck);
}
if (lat != null)
{
ck["Lat"] = lat;
ck["Lon"] = lng;
ck.Expires = DateTime.Now.AddMonths(2);
Response.Cookies.Set(ck);
//this is the code which causes problem. If I remove this section catching will work
//other logic goes here..
}
}