Unload event example : Page Events « Page Lifecycle « ASP.NET Tutorial






<%@ 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("Init.aspx"))
            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>








5.3.Page Events
5.3.1.Here is the sequence of events that are raised whenever you request a page:
5.3.2.Error event example
5.3.3.Page events firing sequence (VB.net)
5.3.4.Page life cycle events
5.3.5.Page flow tracing
5.3.6.Unload event example