<%@ Page Language="vb" %>
<html>
<head>
<title>Unload event example</title>
<script runat="server">
Dim TheFile As System.IO.StreamReader
Sub Page_Load()
TheFile = System.IO.File.OpenText(MapPath("file.txt"))
Message.Text = "<pre>" & _
Server.HtmlEncode(TheFile.ReadToEnd()) & "</pre>"
End Sub
Sub Page_Unload()
TheFile.Close()
End Sub
</script>
</head>
<body>
<asp:label id="Message" runat="server"/>
</body>
</html>
|