开发者

Exception being handled in masterpage

开发者 https://www.devze.com 2023-02-04 20:26 出处:网络
If an exception开发者_开发技巧 was thrown in a page, would it be possible to be handled within the masterpage (assuming it wasn\'t handled before?)If a method on the master page is one in the call cha

If an exception开发者_开发技巧 was thrown in a page, would it be possible to be handled within the masterpage (assuming it wasn't handled before?)


If a method on the master page is one in the call chain above where the exception occurs, it can be caught in it.

What are you trying to accomplish? At a guess I would say that you need to explore the creation of a base page where you have your exception handling and inherit your other pages from it.


You could add handler to Page.Error event:

protected void Master_Init() 
{
    Page.Error += MyErrorHandler;
}

I am not sure, that there is Master_Init method in MasterPage class, but I believe, you got an idea.

0

精彩评论

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

关注公众号