ASP.NET(vb.net) & Substitution - asp:Substitution - asp:Substitution : ASP.NET v1.x introduced a powerful feature known as Partial Page Caching. This feature allowed developers to construct ASP.NET pages which were partly dynamic and partly cached. Regions marked as dynamic are executed on each request while areas marked as cached are executed only once and cached until a specific dependency is enforced. The cached regions are separated into user controls with appropriate cache directives, and the dynamic content either remains in the parent Page or is contained in user controls without cache directives.
ShotDev Focus:
- ASP.NET(vb.net) & Substitution - asp:Substitution
Example
Substitution.aspx
<%@ Page Language="VB" %> <%@ OutputCache Duration=60 VaryByParam="None" %> <script runat="server"> Sub Page_Load() Label1.Text = DateTime.Now.ToString() End Sub Public Shared Function GetTime(ByVal context As HttpContext) _ As String Return DateTime.Now.ToString() End Function </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <div> <p> <asp:Label runat="server" ID="Label1" /> </p> <p> <asp:Substitution runat="server" ID="Substitution1" MethodName="GetTime" /> </p> <p> <asp:Button runat="server" ID="Button1" Text="Submit"/> </p> </div> </form> </body> </html>
Screenshot