Current filter:
                                You should refresh the page.
                                0
                                  • Samples and issue replies recommend t handle the static event ASPxWebControl.CallbackError.

                                    I followed this and defined one commonhandling place and call it from 2 places:
                                      - native Application_Error designed to handle errors outsideof callbacks
                                      - addtional handler designed to handle errors while insde thecallback

                                            protected void Application_Start(object sender, EventArgs e)
                                            {
                                                ASPxWebControl.CallbackError += new EventHandler(Application_Error_DXCallback);
                                            }

                                            protected void Application_Error(object sender, EventArgs e)
                                            {
                                                UnhandledErrorPage.CaptureException(false);
                                            }

                                            protected void Application_Error_DXCallback(object sender, EventArgs e)
                                            {
                                                UnhandledErrorPage.CaptureException(true);
                                            }

                                    I also added the following in web.config file:

                                    <errors callbackErrorRedirectUrl="~/UnhandledError.aspx" />

                                    However, when error occured during callback (got the page from Context.Handler and verified that IsCallback is true), the main handler is called (Application_Error) instead of handler for callback errors (Application_Error_DXCallback).

                                    1. Please review if this is an issue and not by design
                                    2. If this is by design - the design is rather poor. If you any way route to a regular Application_Error event handler why bother introducing static events; you could just do it just by using a public flag - to handle vs. not to handle.

                                    Thank you.

                                0

                                Hello Vadim,

                                I think that I have not reproduced the issue, because it is not quite clear to me what I should expect to be different from the A cookieless session is lost when an exception is handled by a control, and a browser is redirected to an error page. I simply defined the callbackErrorRedirectUrl property and found out that the Application_Error_DXCallback handler is executed, and the server redirects the response to a new page.

                                In the attached screencast, I illustrate that the response is redirected correctly, but the Session State is lost.
                                If I am correct in my expectations, your current bug report duplicates the previous report.

                                Thanks,
                                Vest

                                B199856.zip
                                0

                                Let me clarify the specifics of this current report.

                                Let's look at your example:

                                    void Application_Start(object sender, EventArgs e) {
                                        // Assign Application_Error as a callback error handler
                                        ASPxWebControl.CallbackError += new EventHandler(Application_Error);
                                    }

                                void Application_Error(object sender, EventArgs e) {
                                    // Use HttpContext.Current to get a Web request processing helper
                                    HttpServerUtility server = HttpContext.Current.Server;
                                    Exception exception = server.GetLastError();

                                    ...

                                    if ((HttpContext.Current.Handler is Page) &&
                                         (HttpContext.Current.Handler as Page).IsCallback)
                                        ASPxWebControl.RedirectOnCallback("ErrorPage.aspx");
                                }

                                You are using standard Application_Error handler for both standard handling and to route ASPxWebControl.CallbackError event.

                                Now try to assign ASPxWebControl.CallbackError to a different method and you would notice that the call is still being routed to Application_Error handler - at least that is what happening in my application.

                                0

                                Vadim,

                                The CallbackError event is handled by the same handler that is used by the web application. If you check the sender argument of the Application_Error event handler, you will see a difference when an exception is handled by the ASP.NET framework, or by our controls.

                                For example, in the attached sample, I have tried to reproduce the issue using the ASP.NET 4.0, as you mentioned. Unfortunately, the project still works fine.
                                In the attachment, I included a sample and a screencast, which you can review.

                                Thanks,
                                Vest

                                B199856.zip
                                0

                                I am not as much as concerned that the wrong function is called as that the redirect to an error page loses the session.

                                I tried to get to the bottom of the issue and I was able to replicate your code as well as have the problem appear consistently.
                                The cause of the wierd behvior is the case when unhanled exception occurs inside Page_Init chin of events.

                                I am attaching the sample project which shows that when error occurs inside the callback handler - everything behaves as you describe, when error occurs while inside the Page_Init the exception is hndled by te application_error (with ASP.global_asax as a sender) and error page is redirected to a different session (case of cookieless sessions).

                                Besides Page_Init I am concerned with exceptions inside Render method, inside custom callbacks in the grid, while performing grid operations, which are implemented as callbacks (such as edit form, detail rows, sorting etc.)

                                UnhandledErrorTest.zip
                                0

                                Vadim,

                                I have reproduced the issue and forwarded it to our developers, so they can examine it.
                                Your patience is highly appreciated.

                                Thanks,
                                Vest

                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.