I’m building pages with ASP.Net (Framework 4) and Microsoft Charts.
Those charts require heavy queries to the database and I would like to cache them to prevent my users from overflowing my database with useless queries.
I succeeded in caching my page but my charts disappear when the page is refreshed from cache. I’ve read that it’s because my chart’s images are not stored in the cache.
How can I proceed to avoid my charts from disappearing when the page is reloaded from cache and so they would generate as few queries as possible?
More informations :
- I have a ASPX page that contains a ASCX control.
- In this control, I have a System.Web.UI.DataVisualization.Charting.Chart component, that is populated within the OnLoad method, with a heavy database access.
- I want to cache my ASPX page and therefore my ASCX control to avoid querying the database to often.
- When using this markup <%@OutputCache Duration=”15″ … %>, when hitting F5 my page refreshes itself from cache but my Chart is not lost.
Looks like it was some configuration problem within the Web.config file :
I edited this line as follow :
Then I simply entered the following command in my ASPX file (on Top, right under the <%@ Page …/> markup ) :
Now my page refreshes itself properly from the cache, including my charts.