C# – Response.Redirect in .NET 4.0

asp.netcnet

Response.Redirect() no longer working when upgrade the application to ASP.NET 4.0

  • Response.Redirect() is used inside Update panel
  • and we using the AjaxToolKit 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

Best Answer

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);
Related Topic