The following code is not working in a partial view.
<%
// Pages always expire at midnight.
Response.Cache.SetExpires(DateTime.Today.AddHours(24));
if (variable > 0)
{
Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
}
else
{
Response.Cache.SetCacheability(HttpCacheability.Public);
}
%>
Can anyone tell me why? The partial view is never cached and there is no apparent reason. Should I write code to activate the cache? How?