ASP.NET Recreates Cached Control

I solved most of the caching issues. But still there is one thing. I have a UserControl for which I use output caching. Similar:

<%@ OutputCache Duration="1200" VaryByParam="none" %> 

However, as you can see, the control is recreated every 12 minutes because it takes 5 to 10 seconds to create it.

Now, by default, ASP.NET by default requires you to create a control when the user enters the page and stores it in the cache for 12 minutes. Then, when after 5 minutes the user goes to the page, the control is created again.

Is there a way to get ASP.NET to recreate the control after the 12-minute cache has expired? Regardless of the next user visit?

Or even the perfect solution: recreate the controls in the background after say 11 minutes 50 seconds, and not just replace it with a new one after 12 minutes?

Thanks for the help!

+3
source share
2 answers

Use Windows Scheduled Tasks to enter this page every 12 minutes, because ASP.NET only works with triggers. The trigger can be either Ajax, which requests a different page every 12 minutes, or the next user who comes to your web page.

+1
source

I'm not sure, but it looks like you want your control to be updated asynchronously at intervals while the user views the page?

, Ajax. , Timer UpdatePanels .

, 20 .

0

Source: https://habr.com/ru/post/1753259/


All Articles