473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Response.Redirect after Response.Flush

Is there a way I can call Response.Redirect after I've done a
Response.Flush?
I send some html to load an animated gif that plays whilst my page loads,
it has some extensive database calls to process. However, when I try to
redirect to my error handling page, if there is an error, I get a 'Cannot
redirect after HTTP headers have been sent' error.
I've got round the problem by using a javascript function in the body
onload event that checks a hidden field whose value is set when an error
ocuurs, but this does seem very elegant.
Any ideas?

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
2 2848
Sorry I meant to say that the javascript fix is NOT very elegant.

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #2
Just as the error states, you cannot do a redirect once headers, or any
parge of the page, has been sent to the client. An alternative to what you
are doing would be to just write client side script directly into the
response.
i.e.
Response.Write("<script
language=javascript>window.navigate('mynewpage.asp x);</script>")
Response.End

The above script is not a function so it will execute inline immediately
when sent to the browser and direct client to another page. Think of it as
an immediate client side redirect.
"Glen Wilkin via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote
in message news:e7******************************@DotNetMonste r.com...
Is there a way I can call Response.Redirect after I've done a
Response.Flush?
I send some html to load an animated gif that plays whilst my page loads,
it has some extensive database calls to process. However, when I try to
redirect to my error handling page, if there is an error, I get a 'Cannot
redirect after HTTP headers have been sent' error.
I've got round the problem by using a javascript function in the body
onload event that checks a hidden field whose value is set when an error
ocuurs, but this does seem very elegant.
Any ideas?

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Copa | last post by:
Hello, I am testing buffering an asp page and Flushing information out to the browser, hence i wrote the code in an asp page that follows this Message Post. The loops are suppose to simulate...
7
by: Jon Spivey | last post by:
Experimenting with response.flush() but can't seem to get it to work. This code <% response.write "<p>started</p>" response.flush() for i = 1 to 10000000 i = i +1 next response.write...
3
by: Gary | last post by:
I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like...
12
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.