One of ASP.NET 2.0's new features is the ability to do Post-Cache substitution. This basically allows you to override a portion of a cached page with dynamic content. There are multiple ways of doing this, but one of the easiest ways to do it on a page or user control is to use the Substitution control. All this control, really does is call a custom method that you specify to render that porition of the page.
<%@ outputcache duration="60" varybyparam="none" %>
<html>
<form runat="server">
Cached Content
<%-- Get dynamic porition of the page %>
<asp:substitution id="SubstitutionControl" runat="server" methodname="GetDynamicContent" />
Cached Content
</form>
</html>
The method the substitution control calls would look like this:
protected static string GetDynamicContent(HttpContent httpContext)
{
return "Non-Cached Dynamic Content";
}
This control will prove to be useful any time we have a page that isn't 100% static.
Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=184