Can't call a response redirection in a page callback?

I get the following error when I leave my network inactive for some time

"Response.Redirect.cannot will be called in the page callback."

I store the user IDs in the session and during the loading of the page, which 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 make redirection work?

+5
source share
7 answers

Try using a property Response.RedirectLocationthat works during the callback.

HttpResponse.RedirectLocation MSDN

+7

if (Page.IsCallback)       ASPxWebControl.RedirectOnCallback( "~/Login.aspx" );

http://documentation.devexpress.com/#AspNet/DevExpressWebASPxClassesASPxWebControl_RedirectOnCallbacktopic

+7

devexpress, ASPxGridView, EnableCallbacks. , , , Response.Redirect .

+2

HttpResponse.RedirectLocation MSDN

+2

. , , Response.Redirect , - <script type="text/javascript"/> window.location.href() ?

+1

:

string TARGET_URL = ...;
if(Page.IsCallback)
    DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback(TARGET_URL);
else
    Response.Redirect(TARGET_URL);

KA18851 Devexpress

+1

All Articles