Solved

redirect page After writing out response in excel

Posted on 2008-10-23
4
334 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now