Cache ASP.Net Tutorial

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



    Output Caching


    
    

    

Output Caching


    

Low Level using HttpCachePolicy Class


     
      
      UserName:   
      
      
      State:   
      
    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default_aspx : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
     Response.Cache.SetExpires(DateTime.Now.AddSeconds(10));
     Response.Cache.SetCacheability(HttpCacheability.Public);
     lblTime.Text = "This page was loaded at " + DateTime.Now.ToLongTimeString();
         lblUserName.Text = Request.Params["username"];
     lblState.Text = Request.Params["state"];
    }
}