July 28, 2011

Code Example for caching using Output cache directive

below is the code example to cache a single o/p of a form for some specified duration



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ExCache1.aspx.cs" Inherits="ExCache1" %>


<%@ OutputCache Duration="60" VaryByParam="None" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <body>
    <form id="Form1" method="post" runat="server">
    <p>  This page will be cached for 60 seconds </p>
    </form>
  </body>
</HTML>

No comments:

Post a Comment