Newbie Question on Page_Unload Event

  • Thread starter Thread starter Yang Sun
  • Start date Start date
Y

Yang Sun

Hi,
I read something about asp.net event handling. And I got the
idea that the calling procedure like the following:
1. Page_init
2. Page_Load
3. Page_Unload

And the book said that page_unload is executing at the serverside
and executed after page_load event and before the page was sent to
the browser. So I try to use the Trace feature to debug the Page_Unload
event, but I cannot find the trace output for the Page_Unload event. Why?
Could you help me?

In case you want to have a try, I list the sample asp.net file.

<%@ Page Language="C#" Trace="true" %>
<script runat="server">

// Insert page code here
//
void Page_Load() {
Trace.Write("Page Load here!");
}

void Page_Unload() {
Trace.Write("Page Unload here!");
}

</script>
<html>
<head>
</head>
<body>
Hello World
</body>
</html>

----------------------------------------------------------------------
Trace Information:
aspx.page Begin Init
aspx.page End Init 0.000047 0.000047
Page Load here! 0.000468 0.000421
aspx.page Begin PreRender 0.000517 0.000048
aspx.page End PreRender 0.000557 0.000041
aspx.page Begin SaveViewState 0.000688 0.000131
aspx.page End SaveViewState 0.000717 0.000029
aspx.page Begin Render 0.000744 0.000027
aspx.page End Render 0.000931 0.000187
 
Yang,
As soon as this Trace HTML is generated, it is sent to the browser and
then the Page_Unload event is fired to clean things up. Therefore, your
Trace information on the browser would not contains the trace output
from Page_Unload event
 
Back
Top