I have a new project and a custom error page set up. When an exception or error happens the custom error page gets called but applicatin_error in global.asax never gets called. Other subs in global.asax are working fine (application_start etc). All I have
right now in application_error is a simple trace.write to say "hi I got here" so I know there is nothing in global causing a second exception.
Any ideas? I have this working on other apps but can't get this working on this one.
Have you double checked the procedure name ? I assume that "applicatin_error" is a typo and is NOT the real name you have in global.asax ? You may want to show what is the full signature you used...
I use the codes above to get error on my side, it works fine, I think it is also available for you, or you could post your codes, we will give more precise troubleshooting for you,
Regards
application_errorGlobal.asax
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Yep I'm aware of that. No try statements here. This one's doing my head in. Any other way to get the last error visible in my customer error page? It comes in as null at the moment so it's not being passed along.
Also I assume that you have a test page that does nothing else that throws explicitely an exception when you click a button for example and that have *NO* other content except that.
BTW if it is not called, what is the behavior you see ? Do you see the "yellow page" ? I noticed you told about a trace (but it is still possible that it runs without the trace being shown for some reason).
What if you use a Stop statement inside this handler or put a breakpoint (and in this case put a breakpoint as well in some other global.asax procedure to make sure breakpoints are ok). If you see the "yellow page" it could be that Server.ClearError is not
called.
Member
1 Points
75 Posts
application_error not getting called
Sep 08, 2013 05:58 AM|kevinof|LINK
Hi all,
I have a new project and a custom error page set up. When an exception or error happens the custom error page gets called but applicatin_error in global.asax never gets called. Other subs in global.asax are working fine (application_start etc). All I have right now in application_error is a simple trace.write to say "hi I got here" so I know there is nothing in global causing a second exception.
Any ideas? I have this working on other apps but can't get this working on this one.
thanks
application_error Global.asax
All-Star
48280 Points
17983 Posts
Re: application_error not getting called
Sep 09, 2013 06:53 AM|PatriceSc|LINK
Hi,
Have you double checked the procedure name ? I assume that "applicatin_error" is a typo and is NOT the real name you have in global.asax ? You may want to show what is the full signature you used...
application_error Global.asax
Member
1 Points
75 Posts
Re: application_error not getting called
Sep 09, 2013 07:26 AM|kevinof|LINK
Just a typo. I'm using Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
thanks
application_error Global.asax
All-Star
32817 Points
3815 Posts
Re: application_error not getting called
Sep 09, 2013 08:01 AM|Angie xu - MSFT|LINK
Hi,
I use the codes above to get error on my side, it works fine, I think it is also available for you, or you could post your codes, we will give more precise troubleshooting for you,
Regards
application_error Global.asax
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
1 Points
75 Posts
Re: application_error not getting called
Sep 09, 2013 08:33 AM|kevinof|LINK
That's not going to work. Like I said in the first post application_error is getting even getting called.
thanks
application_error Global.asax
All-Star
52793 Points
9695 Posts
MVP
Re: application_error not getting called
Sep 10, 2013 09:51 AM|Ruchira|LINK
Please note that application_error in global.asax file will only get fired for unhandled exceptions. You need to remove try catch blocks.
application_error Global.asax
Please 'Mark as Answer' if this post helps you
My Tech BlogMember
1 Points
75 Posts
Re: application_error not getting called
Sep 10, 2013 05:50 PM|kevinof|LINK
Yep I'm aware of that. No try statements here. This one's doing my head in. Any other way to get the last error visible in my customer error page? It comes in as null at the moment so it's not being passed along.
application_error Global.asax
Contributor
6711 Points
2334 Posts
Re: application_error not getting called
Sep 11, 2013 05:13 AM|cnranasinghe|LINK
Hope this is not a web service project. Have a look @ this.
application_error Global.asax
Member
1 Points
75 Posts
Re: application_error not getting called
Sep 11, 2013 05:15 AM|kevinof|LINK
No just a web form apps. Think I'm going to cry
application_error Global.asax
Contributor
6711 Points
2334 Posts
Re: application_error not getting called
Sep 11, 2013 05:50 AM|cnranasinghe|LINK
Follow this thread, may be similar setting on your web.config.
application_error Global.asax
All-Star
48280 Points
17983 Posts
Re: application_error not getting called
Sep 11, 2013 07:56 AM|PatriceSc|LINK
As you are using VB what if you add a http://msdn.microsoft.com/en-us/library/6k46st1y.aspx (handles) clause to make 100% sure this event handler is attached.
Also I assume that you have a test page that does nothing else that throws explicitely an exception when you click a button for example and that have *NO* other content except that.
BTW if it is not called, what is the behavior you see ? Do you see the "yellow page" ? I noticed you told about a trace (but it is still possible that it runs without the trace being shown for some reason).
What if you use a Stop statement inside this handler or put a breakpoint (and in this case put a breakpoint as well in some other global.asax procedure to make sure breakpoints are ok). If you see the "yellow page" it could be that Server.ClearError is not called.
application_error Global.asax