ASP display page, wait, redirect

I am trying to make this page show up, then wait before redirecting.  The redirect code works good but the page does not display.  I tried putting all the ASP code before the <body><img...tags and after.  The function of the page is just to add info into tables into the database.  I wanted an image to display that basically illustrates to the user what is happening.

.........code
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear

'Wait, then logout
strInNow = Time
      While Time < DateAdd("S", 10, strInNow)
      Wend

Response.Redirect "logout.asp"
LVL 3
Insomniac_PhDAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

muzzy2003Commented:
Try putting:

Call Response.Flush()

just before you do the time consuming stuff. It sends all pending output to the client immediately while you do the time consuming stuff. You won't then be able to use Response.Redirect, though. You'd have to finally send some JavaScript like this:

<script language="javascript">
window.location.href = 'logout.asp';
</script>

to achieve the redirection.
AgentSmith007Commented:
<script language="javascript">
function fRedirect(){
   location.replace("http://www.intel.com");
}
//5000 = 5 second wait
self.setTimeout('fRedirect()', 5000)
</script>
muzzy2003Commented:
I read the question to imply that the image is displayed while some server side processing goes on. If this is not the case, then Agent Smith's answer works fine. If it is, then perhaps you might want to add his/her timeout to my bit of JavaScript to ensure that the image is visible for long enough. For example, if the processing only takes 0.5 seconds, then the user won't get much of a chance to view the image. Combining the two gives a third solution that may also be the best for your needs.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

shankarkrupaCommented:
Try this...?

<%
.........code
Set rs = Nothing
conn.Close
Set conn = Nothing
%>

Loggin off...Please wait.

<img src="logout.jpg">

<script language="javascript">
function logout()
{
document.location.href="logout.asp"
}
setTimeout('logout()',5000)
</script>
shankarkrupaCommented:
Oh, sorry. Didn't see your replies. basically same. Sorry Muzzy & Agent Smith.

Krupa
hujiCommented:
Well there is a way if you really want to do it with only ASP. Your response text is not shown, because it is not sent to user yet. So you can force it to be sent using response.Flush . Also you have to set response.buffer to TRUE in the FIRST line of your code:

<% response.buffer = true %>
...
<%
.........code
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Flush                 'Not response.clear

'Wait, then logout
strInNow = Time
      While Time < DateAdd("S", 10, strInNow)
      Wend

Response.Redirect "logout.asp"

....


%>




Wish I can help
Huji
muzzy2003Commented:
Er ... isn't Response.Flush what I suggested 40 minutes ago huji?
muzzy2003Commented:
Also, you can't use Response.Redirect after Response.Flush, as the HTTP headers will already have been written, and one of these is used to perform the redirection.
hujiCommented:
Yes muzzy2003! I sent the code knowing that. I just wanted to help the author to reach to a better understanding, with a sample code. The idea is yours.
Huji
PS: We are basically here to help, not to harvest points! I sent that just for this reason. I hope you have a same opinion.
muzzy2003Commented:
One other point: Response.Buffer = True is not necessary - if it was currently set to False then the output would be sent directly to the client anyway, and the question wouldn't have arisen. Setting Response.Buffer = False at the top would in fact be another alternative to Response.Flush.
Insomniac_PhDAuthor Commented:
OK, I am giving your solutions a try... give me a few moments here.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.