Вопрос

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

Это было полезно?

Решение

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

Другие советы

I did it without the last line and it works.

HttpContext.Current.Response.RedirectLocation = "http://www.google.com";

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top