Solved

page_error will not fire during a callback

Posted on 2009-07-08
1
645 Views
Last Modified: 2012-05-07
Hi, I'm working with visual studio 2005, visual basic .net and I'm trying to use the Page_Error method to catch unhandled exceptions in my code.  I want to catch errors during callbacks, is there something about the way callbacks are handled that prevents the Page_Error method from being called because no matter what I do I don't seem to be able to get it to fire.

The sequence of events is:

Javascript makes call to RaiseCallbackEvent
RaiseCallbackEvent calls a function with an error in it (Throw New ArgumentNullException("error"))
At this point I expect Page_Error to be raised, but the code immediately calls GetCallbackResult.

I have autoeventwireup = "false" in my page but I'm using Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error.  I thought that using Handles means you don't need autoeventwireup set to true.

I've tried:
Adding the Addhandler to the Page_Load Event on my page.
Setting autoeventwireup = "true"
Changing the Handles Me.Error to MyBase.Error (I read somewhere that that would fix it)

All to no avail.  I appreciate anyone who can shed some light on this subject for me.

Edit: I've done some more testing and found that the Page_Error works just as I would expect if I'm NOT in a callback.  If I place the fake error in the page load event the Page_Error event does fire.  This makes me believe that everything is wired up correctly, I suppose I'm just not using the correct method for catching errors during a callback.  

Thanks
0
Comment
Question by:Schweeneh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Schweeneh earned 0 total points
ID: 24814641
I did a little more research and I eventually stumbled across the solution.  The answer is in the GetCallbackEventReference function.

GetCallbackEventReference(Me, "arg", "doNothing", "", "raiseError", True)

When registering the javascript to do the callback on the page I hadn't even noticed that one of the overloads of this function includes a client side error handling function.  I'm not sure how it works but during a callback errors are routed to this function instead of the original callback function (doNothing in the case above).
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question