Solved

redirect page After writing out response in excel

Posted on 2008-10-23
4
363 Views
Last Modified: 2008-10-27
I have a html file containing a form that allows user to enter start date and end date that are relevant for retrieiving a recordset.  When the user click on the submit button on the form, a wait message will be displayed and then the data is submitted to an ASP page that process the request by querying the database using the supplied parameters of dates.   In that ASP page the response contenttype has been changed to application/vnd.ms-excel so that the recordset can be written out in excel format.  As a result, a diaglog box always appears asking user if they want to save/open the file (or cancel the transaction).   However, when the diaglog box appears, the browser is still showing the wait message of the html file that calls the ASP page.   Is there anyway to redirect the page after the save diaglog box appears so that the user won't see the wait message any longer?
0
Comment
Question by:ayc8
  • 3
4 Comments
 
LVL 7

Expert Comment

by:bluV11t
ID: 22788914
I guess you could use a javascript with a timeout to redirect the page in lets say 5 seconds. Of course the page will always redirect after 5 seconds but I don't think it will interfere with the excel file. Put this in  the head tag of your wait message page:
<script language=javascript>
function fnRedir(){
location.href='url_of_page_to_redirect_to';
}
</script>
 
 
//Put this into the onClick event of the button showing the wait message or the (javascript) function showing the wait message:
 
timerID = setTimeout('fnRedir()', 5000);

Open in new window

0
 

Author Comment

by:ayc8
ID: 22789551
Hi bluV11t:
thank you very much for your quick reply. However, what I was hoping to accomplish is that  once the downloading processing is complete in the ASP page that renders the response in excel, the calling page (the html page with the wait message) will refresh itself  so that the wait message will not be there any more. I have tried doing a Response.Redirect (back to the calling page) in the ASP page, but that does not do the trick (It works if I put this before Response.Flush() at the end of this page, but the page won't render the response). I have even tried using javascript by attaching an onload event  to the ASP page so that the document location will be changed back to the calling page to the ASP page. That code didn't seem to execute. It seems that once I set the response header to application/vnd.ms-excel, any javascript code is ignored. Any idea what I can do to fix this?
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 22789636
Did you try Response.Flush() after binarywriting the excel and then add new header (text/html) and some html after that? If that works i think you could add some javascript on the asp page to remove the waiting message on the html page... It sounds like a crazy idea, I'll have to test it at work tomorrow :-D
0
 
LVL 7

Accepted Solution

by:
bluV11t earned 500 total points
ID: 22794894
Tried it now, it had no effect...
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question