开发者

Better user experience for website in asp.net MVC

I have a page that downloads a large HTML file from another domain 开发者_Go百科then serve it to the user. The file is around 100k - 10MB and usually takes about 5min. What was think about doing something like this to make the user experience better.

  • download file
  • if file is not download within 10 seconds then displays a page that tells the user that the file is being downloaded
  • if the server completes the download in 1 second then it will serve the downloaded html

can this be done? do I need to use the async feature?

Updated question: the downloaded file is a html file


In order to provide an 'asynchronous' file download try a trick that Google is using: Create a hidden iframe and set it's source to the file you want to download. You can then still run javascript on your original page while the file is being downloaded through the iframe.


I think you should:

  1. Return an HTML page to the user straight away, to tell them the transfer has started.
  2. Start the download from the other domain in a separate process on your server.
  3. Have the HTML from step 1 repeatedly reload, so you can check if the download has completed already, and possibly give an ETA or update to the user.
  4. Return a link to the user when the initial transfer is complete.


It sounds like you need to use a waiting page that refreshes itself every so often and displays the status of your download. The download can be run on a separate thread using a System.Threading.Task, for instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜