Redirect during Async Postback causing an error

N

Norm

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.
 
N

Norm

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.

I ended up doing it on the client. The was my solution: (slash
workaround)

ScriptManager.RegisterClientScriptBlock(Me, GetType(Object),
"redirect", "window.location.href='RequestSubmit.aspx'", True)

Happy coding!
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top