Current filter:
                                You should refresh the page.
                                  • This KB Article addresses the following questions:
                                    1) Why may the "Response.Redirect cannot be called in a Page callback" error occur?
                                    2) How to redirect a page while processing a callback request?

                                1 Solution

                                Creation Date Importance Sort by

                                The HttpResponse.Redirect method cannot be used while processing a callback request because of specifics of its life cycle.
                                As a result, the "Response.Redirect cannot be called in a Page callback" error may occur.

                                When processing server-side operations invoked through a MS AJAX callback, ICallbackEventHandler (most of "large" DevExpress ASP.NET controls such as ASPxGridView, etc. perform server-side operations through callbacks), it is necessary to use the DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback method. It allows redirecting a page to the specified URL when server-side processing is completed:

                                [C#]
                                string TARGET_URL = ...; if(Page.IsCallback) DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback(TARGET_URL); else Response.Redirect(TARGET_URL);
                                [VB.NET]
                                Dim TARGET_URL As String = ... If Page.IsCallback Then DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback(TARGET_URL) Else Response.Redirect(TARGET_URL) End If
                                • Winanjaya @Primtek 04.27.2016
                                  Thanks a lot!
                                • Philip Johnston 09.01.2016
                                  Did you solve your issue I am having the problem on the scedulre but I have no redirects in the loop at all in my code behind it appeard on the control itself.
                                • Helen (DevExpress Support) 09.02.2016

                                  Hello Philip,

                                  To process your inquiry more efficiently, I've created a separate ticket on your behalf (T422480: Response.Redirect cannot be called in a Page callback when the approach from KA18851 is used in ASPxScheduler). It has been placed in our processing queue and will be answered shortly.

                                • Slack 09.14.2017
                                  Since this post was around a year ago I believe the correct code to call is now:

                                  DevExpress.Web.ASPxWebControl.RedirectOnCallback(TARGET_URL);

                                  I am having an issue where everytime this executes from our MASTER PAGE, I get the following exception:

                                  Object reference not set to an instance of an object.

                                  I don't know if the code would change on a Master Page where this code would have to work universally for any DevExpress control on a child page that may be causing a callback when we need to redirect to our login screen instead.
                                • Marina (DevExpress Support) 09.14.2017

                                  Hello,

                                  I've created a separate ticket on your behalf (ASPxGridView - How to call the RedirectOnCallback method in master page). It has been placed in our processing queue and will be answered shortly.