Asp.net OutputCache Example

Output Cache Will determine when page will refresh

the following example shows that date time will be updated every 10 seconds, if client keeps on pressing F5 to refresh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="outputCacheTest.aspx.cs" Inherits="WebApplication.outputCacheTest" %>
<%@ OutputCache duration="10" varybyparam="None" %>
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%= DateTime.Now.ToString() %><br />
    </div>
    </form>
</body>
</html>
This entry was posted in Uncategorized. Bookmark the permalink.