Show ASP.NET Page then send file with Response.WriteFile

i need to show an asp.net page with a message like "Your download will start soon..." then, i need to send a file with Response.WriteFile(myfile). The problem is that i insert my code into Page_LoadComplete, because i assume asp.net will show and rendere basic html, then in the code there is Response.WriteFile(strFullPath). The problem is that no html is rendered, and the file is transfered correctly ! How can i also show a simple html like "Your download is in progress" ... ?

Thanks

Answers


I would suggest moving your Response.WriteFile(struFullPath) to another page all by itself that does nothing but write out the file. Then on your page that says "Your download will start soon...", use one of these methods to write out a link to the page that does the Response.WriteFile.

If you don't want to follow the link for the methods, it's either:

Put the file link into an iframe and it will download

<iframe src="LINKTOTHEFILEPAGE"></iframe>

You could use some JavaScript and a backup meta refresh tag. Load up your html content as you normally would and inject this into the <head>.

<script>
     setTimeout(function(){window.location='LINKTOTHEFILEPAGE';}, 5000);
</script>
<noscript>
    <meta http-equiv="refresh" content="5; url=LINKTOTHEFILEPAGE">
</noscript>

Both of these delay the download by 5 seconds. You can adjust as necessary.


Need Your Help

Executing a script via AJAX on Firefox OS device

javascript jquery ajax firefox-os

My question regards the Apps CSP https://developer.mozilla.org/en-US/Apps/CSP

Android Alarmmanager Notifications Not Appearing After Long Idle Periods

android alarmmanager

I have been trying to fix this problem for weeks. The basic problem is that after a device has been left alone for a long period of time (8 hours) the scheduled notification will not activate. In

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.