Search code examples
http-redirectcallbackresponse.redirecticallbackeventhandler

Calling Response.RedirectLocation from within ICallbackEventHandler.RaiseCallbackEvent does nothing


We're attempting to make a redirect during a page callback. We have an aspx page that is implementing ICallbackEventHandler. Inside of the ICallbackEventHandler.RaiseCallbackEvent() event handler in the code-behind we're attempting to use the Response.RedirectLocation to move the user on to another aspx page. Our code is below.

void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
    HttpContext.Current.Response.RedirectLocation = "http://www.google.com";
    HttpContext.Current.Response.End();
}

After raising the event client-side and setting breakpoints in the event handler we are sure that the code is being called but the page doesn't actually redirect. Are we missing something important here? We've tried several other ways including setting the Response.StatusCode and using Flush() instead of End(). Let me know if you need any additional information about what we're trying to do.

Any ideas would be greatly appreciated!

Thanks, Daniel


Solution

  • The old fashioned way was Response.Redirect(url). Does that fix it?