I am getting the following error when I leave my web inactive for a while
"Response.Redirect.cannot be called in a Page callback."
I'm storing the user ids in session and during page load I check to see if the user id exists if not then I redirect them to the login page.
I am using devexpress controls, How can I get the redirect to work?
if (Page.IsCallback) ASPxWebControl.RedirectOnCallback("~/Login.aspx");
http://documentation.devexpress.com/#AspNet/DevExpressWebASPxClassesASPxWebControl_RedirectOnCallbacktopic
Try using the Response.RedirectLocation
property instead which works during callback.
HttpResponse.RedirectLocation Property on MSDN
You can usually turn callbacks off for devexpress controls like the ASPxGridView using the "EnableCallbacks" property. This will obviously cause the controls to use postbacks, but it will also allow Response.Redirect to do its job.
HttpResponse.RedirectLocation
Property on MSDN works for me in same problem
here is the sample code from Msdn
Response.StatusCode = 301;
Response.Status = "301 Moved Permanently";
Response.RedirectLocation = "http://www.newurl.com ";
Response.End();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With