Response.Redirect()
no longer working when upgrade the application to ASP.NET 4.0
Response.Redirect()
is used inside Update panelAjaxToolKit 4.0
it gives me the error:
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near
Response.Redirect. Transfers the page control to the other page, in other words it sends the request to the other page. Causes the client to navigate to the page you are redirecting to. In http terms it sends a 302 response to the client, and the client goes where it's told.
For instance, instead of a "form" button that causes a postback and redirect, you could use a LinkButton that will behave like a hyperlink, allowing the browser to request the new page directly.
So, in brief: Response. Redirect simply tells the browser to visit another page. Server. Transfer helps reduce server requests, keeps the URL the same and, with a little bug-bashing, allows you to transfer the query string and form variables.
redirect() The redirect() method of the Response interface returns a Response resulting in a redirect to the specified URL.
you have to do this
string redirectURL=(a proper url goes here)
string script = "window.location='" + redirectURL + "';";
ScriptManager.RegisterStartupScript(this, typeof(Page), "RedirectTo", script, true);
UpdatePanel doesn't support resonse.redirect asynchronousely. You should either completely postback the page or avoid using it.
http://forums.asp.net/t/1539851.aspx/1?Response+Redirect+not+working+on+an+UpdatePanel+if+redirecting+to+a+ClickOnce+application+in+some+cases+
http://forums.asp.net/t/1392827.aspx
How to fix error: The message received from the server could not be parsed
Try passing True
as the second argument like this:
Response.Redirect("http://...", true);
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