I have page that just shows the order of page events firing.
It works fine unless I have a response.write in the page_unload section.
I was wondering why that is the case?
The page is:
The error I get is:
Thanks,
Tom
It works fine unless I have a response.write in the page_unload section.
I was wondering why that is the case?
The page is:
Code:
<%@ Page Language="VB" Debug="true" %>
<Script Runat="Server">
Sub Page_Init
response.write("Init Event<br>")
End Sub
Sub Page_PreRender
response.write("PreRender Event<br>")
End Sub
Sub Page_Unload
response.write("Unload Event<br>")
End Sub
Sub Page_Load
Dim RanNum As New Random
response.write("Load Event<br>")
response.write("isPostBack = " & isPostBack & "<BR>" & "Page.isPostBack = " & Page.isPostBack & "<br>")
response.write("Random number = " & RanNum.Next( 1, 11 ) & "<br>")
End Sub
</Script>
<html>
<head><title>IsPostBack.aspx</title></head>
<body>
<form Runat="Server">
<asp:button Text="Click Here!" Runat="Server"/>
<p>
</form>
</body>
</html>
The error I get is:
Code:
Response is not available in this context.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Response is not available in this context.
Source Error:
Line 12:
Line 13: Sub Page_Unload
Line 14: response.write("Unload Event<br>")
Line 15: End Sub
Line 16:
Source File: c:\inetpub\[URL unfurl="true"]wwwroot\ispostbackEvents.aspx[/URL] Line: 14
Stack Trace:
[HttpException (0x80004005): Response is not available in this context.]
System.Web.UI.Page.get_Response() +63
ASP.IsPostBackEvents_aspx.Page_Unload() in c:\inetpub\[URL unfurl="true"]wwwroot\ispostbackEvents.aspx:14[/URL]
System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +10
System.Web.UI.Control.OnUnload(EventArgs e) +67
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +121
System.Web.UI.Page.ProcessRequestCleanup() +24
System.Web.UI.Page.ProcessRequest() +218
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
Thanks,
Tom