Interesting OutputCache expiration problem

Y

yashgt

Hi,

I have a user control MyControl.ascx which appears on various pages in
my ASP .NET 2.0 application. I have setup partial-page caching using
OutputCache directive so that this control gets cached on each page.
However, there is one page Update.aspx which contains the control and
has features that update the DB entries that determine the output of
the control.

I have set SqlDependency so that the control's cache is expired when
the table is updated. But on this page, if I update the DB, the cache
does not expire immediately, and hence when the page is returned back
to the user the control still shows the older values. The cache is not
expired immediately because the SqlDependency is only periodically
refreshed to check if there is a change. Since the DB is updated on
postback in an event handler, the postbacked page is returned with the
older cached control.

Is there a way to expire the control's cache immediately so that the
control on this page renders with the updated values?

Thanks,
Yash
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top