1

Just a quick question so I full understand this better, the way I understand it currently is if you set a page to be cached the HTML generated is essentially saved and then reserved.

This means no code behind on that page is run until the cache expries and regenerates. Also, if say for example I have a dynamically generated date stamp, this will always be the date the cache was generated.

Is this correct?

Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
  • I think you got it right, provided there's not "vary by" parameters and you don't handle any authentication or authorization in your page. If you need to update a datestamp, then ASP.NET provides a way around this. – kͩeͣmͮpͥ ͩ Apr 08 '11 at 08:36
  • You can use output caching but still leave a 'donut hole' part of the page that will still run on every page request, but outside the usual page lifecycle. See http://stackoverflow.com/questions/3318570/turn-off-page-level-caching-in-a-user-control/3318609#3318609 – Jon Adams Oct 21 '11 at 23:10

2 Answers2

3

Read the artice about caching. If you want to fully understand Http Caching, you should also read Caching In Http. And the answer is yes, once the page is saved in cache, no code behind is run before it's regenerated. Also, dynamically generated content will stay in cached page as static

archil
  • 39,013
  • 7
  • 65
  • 82
1

Yes, but you can flag some portions of code or some controls to be rewrited. You can catch only some controls or all controls except one...

Catch the data from database or some collections...

Is a lot flexible.

Alberto León
  • 2,879
  • 2
  • 25
  • 24