<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
The page has been requested
<asp:Label ID="myLabel" runat="server" />
times!
</div>
</form>
</body>
</html>
File: Default.aspx.vb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
If Application("PageCounter") >= 10 Then
Application.Remove("PageCounter")
End If
If Application("PageCounter") Is Nothing Then
Application("PageCounter") = 1
Else
Application.Lock()
Application("PageCounter") += 1
Application.UnLock()
End If
myLabel.Text = Application("PageCounter")
End Sub
End Class
|