rafaelrgl
asked on
Caching page for 24hours
Hi, i want my content to be refresh every day at midnight, so i would cache for 24hours. but my problem is, if i use this command here:
<%@ OutputCache VaryByParam="none" Duration="86400"%>
it will cash for 24hours but will not refresh at midnight. How can i accomplish this.
<%@ OutputCache VaryByParam="none" Duration="86400"%>
it will cash for 24hours but will not refresh at midnight. How can i accomplish this.
ASKER
the way you show above will apply to my aplication, not just one webusercontrol, that code is inside an webusercontrol. So, is there anyway to mark expiration date, then when expire mark again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this....
<% DateTime dte = DateTime.Now; %>
<meta http-equiv="refresh" content="<%=86400 - (((dte.Hour * 60) + dte.Minute) * 60) %>">
<% DateTime dte = DateTime.Now; %>
<meta http-equiv="refresh" content="<%=86400 - (((dte.Hour * 60) + dte.Minute) * 60) %>">
You can callback with HttpRuntime.Cache.
or may be try a different approach like using timer,
protected void Application_Start()
{
Timer customTimer = new Timer();
customTimer.Elapsed += new ElapsedEventHandler(YourHa
customTimer.Interval = YourInterval;
customTimer.Start();
}