I use the Respose.Writeon event Page_Unload, then I get an error
Respose.Write
Page_Unload
In this context, the answer is not available.
May I find out why we cannot use?
protected void Page_Unload(object sender, System.EventArgs e) { Response.Write(" hi "); }
This is because the event is Unloadfired after the page has been displayed. The page has already been completed and there is no longer a response stream that you can record on the way to the browser.
Unload
From an MSDN article in ASP.NET Lifecyle :
, . , Response.Write, .
, , .
. , . , .
MSDN:
:
... , , .
... , , , .
Unload , . .
ASP.NET.
. , . , Response.Write, exception.
Response.Write
exception
HTML HTML . , .
ASP.NET
Read the page life cycle: http://msdn.microsoft.com/en-us/library/ms178472.aspx
UnLoad appears after rendering, so at that moment you displayed everything that you can on the screen.