The outputcache attribute generated a hidden exception because the Duration property was not specified. However the duration cannot be 0 so that made the OutputCache attribute not very usefull for me. I decided to create my own NoCache attribute to take care of the work. (See code below)
Using this attribute instead of the OutputCacheAttribute solved my problem.
using System;
using System.Web;
using System.Web.Mvc;
namespace Cormel.QIC.WebClient.Infrastructure
{
public class NoCacheAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false);
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetNoStore();
base.OnResultExecuting(filterContext);
}
}
}