My guess would be that the unload event fires too late. Your last chance at rendering output would be in the PreRender or Render events/methods. Look at the page lifecycle.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-pageobjectmodel.asp>I would like to understand how the Page_Unload() is suppose to work. According to some research, the following is said:
>
>The Page_Unload event happens when the page has finished being processed by ASP.NET, and before it's sent to the browser.
>
>If that is true, then, why doesn't the following work:
>
>
> ' Perform any cleanup here!
> Sub Page_Unload(ByVal Sender As System.Object, ByVal e As System.EventArgs)
> Response.Write("<SCRIPT>")
> Response.Write("alert(""The page has finished loading."")")
> Response.Write("</SCRIPT>")
> End Sub
>