我想关闭HTTP响应的缓存。这是我的代码:
public class CacheControlHeaderAttribute : ResponseFilterAttribute
{
public override void Execute(IRequest req, IResponse res, object responseDto)
{
res.AddHeader(HttpHeaders.CacheControl, "no-store,must-revalidate,no-cache,max-age=0");
res.AddHeader("X-Test", "Hello from ServiceStack!");
}
}
问题是它不起作用。 Cache-Control已设置为private。我该如何解决?