This project is read-only.

Response.Redirect Bug

Sep 21, 2008 at 11:40 AM
when do Response.Redirect in a usercontrol it redirectes in updatePanel not in desired parent main page. also with error.$0$0$0$0Response.Redirect not work properly.$0$0what should  I do ?$0
Sep 25, 2008 at 3:48 PM
Hi Issiren,

this is not a bug at all.
The contents that are returned by the PartialUpdatePanel are rendered into the page by JavaScript.
So there is by design no way to use Response.Redirect, because this would produce a HTTP-header with code 302.
The headers are ignored if you use a asynchronous postback.

So the only way to redirect is again to use JavaScript.

Here is an excmple for you that you can use in the code behind of your UserControl.
This produces a JavaScript-Statement that causes the browser to redirect to a new page:



script = string.Format("document.location.href='{0}';", VirtualPathUtility.ToAbsolute("~/ThePageToRedirectTo.aspx"));



ScriptManager.RegisterStartupScript(this, GetType(), "redirect", script, true);


 I hope I could help you.

Best regards,
May 5, 2011 at 6:31 AM


i need to handle Response.redirect on the aspx page when i get the call from the security server, where i can hit the code behind.

how should i handle it??