How to use OutputCache directive with Substitution in asp.net

asp.net Substitution control example: how to use OutputCache directive with Substitution
SubstitutionControlExample.aspx

<%@ Page Language="C#" %>
<%@ OutputCache Duration="3000" VaryByParam="none" %>

<!DOCTYPE html>

<script runat="server">
    static string GetCurrentTime(HttpContext context) {
        return DateTime.Now.ToLongTimeString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>asp.net Substitution control example: how to use OutputCache directive with Substitution</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1 style="color:Red">Substitution Control Example</h1>
        <asp:Label ID="Label1" runat="server"></asp:Label>
        Page Cached Time:
        <h2 style="color:Teal">
            <%= DateTime.Now.ToLongTimeString() %>
        </h2>
        <hr />
        Current Time:
        <h2 style="color:Navy">
            <%= DateTime.Now.ToLongTimeString() %>
        </h2>
        <hr />
        Current Time from Substitition Control [Real]
        <h2 style="color:Green">
            <asp:Substitution ID="Substitution1" runat="server" MethodName="GetCurrentTime" />
        </h2>
    </div>
    </form>
</body>
</html>
More asp.net example