Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

page_error will not fire during a callback

Posted on 2009-07-08
1
Medium Priority
?
653 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview

610 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