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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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(YourHandler.YourRepopulationEvent);
    customTimer.Interval = YourInterval;
rafaelrglAuthor Commented:
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.
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1998 13:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT
ETag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html

Open in new window

if you want to implement something similar to this you may need to look for a detail discussion @

Check the documents in detail.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try this....

<% DateTime dte = DateTime.Now; %>
<meta http-equiv="refresh" content="<%=86400 - (((dte.Hour * 60) + dte.Minute) * 60) %>">
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.