开发者

Does unhandled exception before Page_Unload stop Page_Unload handler from running?

开发者 https://www.devze.com 2022-12-12 13:31 出处:网络
Does ASP.NET execute the Page_Unload handler regardless of an unhandled exception during page execution, or do you ha开发者_StackOverflow中文版ve to manually catch exceptions in page code blocks to be

Does ASP.NET execute the Page_Unload handler regardless of an unhandled exception during page execution, or do you ha开发者_StackOverflow中文版ve to manually catch exceptions in page code blocks to be sure that Unload will always run?


This is just for posterity, since I was searching for this answer and found this page fairly early on.

Tests on an ASP.Net 2.0 website I'm running and the article here:

http://forums.asp.net/t/515267.aspx/1?Is+Page_Unload+always+called+

Seem to indicate that Page_Unload() is always called. (Whether interrupted by Redirect, Transfer, or Exception)


If an unhandled exception occurs, the only event that is triggered is Application_OnError, no more page events are triggered. If you want the page cycle to contine you have to catch the exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消