RE: Redirect during Async Postback causing an error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



generally you can not do a response redirect from an async postback. the ajax
call wants to parse the reponse to decide what to do. unless the page your
code redirects knows what type of response to build and send back (no builtin
support for this), the client side gets this error.

the most common solution is redirecting from an async postback is to use
ScriptManager.RegisterStartupScript to render javascript that does the
redirect (document.location.href)


-- bruce (sqlwork.com)


"Norm" wrote:

The error that pops up in a JS alert box is:

Sys.WebForms.PageRequestManagerParserErrorException: The message from
the server could not be parsed. ... "<DOCTYPE ..."

I have three update panels and a couple of AJAX toolkit extenders on
the page. The button that causes the problem is simply sending an
email then redirecting to a "Thank You" page. There are two update
panels that are both set to conditionally trigger on that button
click. The reason for these update panels is multiple validation
groups that need to be validated. When I Googled this problem, all I
got was that Response.Redirect() is suppossed to work, but it doesn't.
I am using .NET 3.5.

Thanks in advance for any help.
Norm

P.S. I might be missing something stupid, I've been up for a long time.

.



Relevant Pages

  • Re: AJAX Page Loading Failure on Some Browsers
    ... the updateprogress control is designed to run during an async postback. ... the ajax code receives this, and sets the document.location to the new url (to do the redirect). ... if you are doing this on your local box, the redirect response may come before the progress bar even has chance to start. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: php/ajax question
    ... When you use "HEADER()", an HTTP header is sent to client browser. ... using with an ajax call the header cannot redirect the page. ... But when using ajax. ...
    (php.general)
  • Re: php/ajax question
    ... So when using with an ajax call the header cannot redirect the page. ... If you want to redirect client browser to some other location then you can work around with javascripts. ...
    (php.general)
  • Re: Web Page Question
    ... Search google on asp.net ajax atlas for dozens of samples. ... On submit the page the info is saved to a db, connects to third party web apps and retrieves data, and third party data is saved. ... I want to be able on submit is redirect the user to a loading page while the app is doing the above functionality and then when finished user is redirect to a new page. ...
    (microsoft.public.dotnet.framework.aspnet)