using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
            Label1.Text += "Page posted back.<br>";
        else
            Label1.Text += "Page created.<br>";

        if (Cache["TestItem"] == null)
        {
            Label1.Text += "Creating TestItem...<br>";
            DateTime TestItem = DateTime.Now;
            Label1.Text += "StoringTestItem in cache for 30 seconds.<br>";
            Cache.Insert("TestItem", TestItem, null, DateTime.Now.AddSeconds(30), TimeSpan.Zero);
        }
        else
        {
            Label1.Text += "Retrieving TestItem...<br>";
            DateTime TestItem = System.Convert.ToDateTime(Cache["TestItem"]);
            Label1.Text += "TestItem is '" + System.Convert.ToString(TestItem) + "'<br>";
        }
        Label1.Text += "<br>";

    }
}
