Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:11:15+00:00 2026-06-09T13:11:15+00:00

I need to download a zip file created in realtime from a webservice. Let

  • 0

I need to download a zip file created in realtime from a webservice.
Let me explain.
I am developing a web application that uses a SoapXml webservice. There is the Export function in the webservice that returns a temporary url to download the file. Upon request to download, the server creates the file and makes it available for download after a few seconds.
I’m trying to use

webClient.DownloadFile(url, @”c:/etc../”)

This function downloads the file and saves it to me 0kb. is too fast! The server does not have time to create the file. I also tried to put

webClient.OpenRead(url); 
System.Threading.Thread.Sleep(7000);
webClient.DownloadFile(url, @"c:/etc../");

but does not work.
In debug mode if I put a BREAK POINT on webClient.DownloadFile and I start again after 3, 4 seconds, the server have the time to create the file and I have a full download.

The developers of the webservice suggested me to use “polling” on the url until the file gets ready for the download. how does it work?

How can I do to solve my problem? (I also tried to DownloadFile Asynchronous mode )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:11:16+00:00Added an answer on June 9, 2026 at 1:11 pm

    I have similar mechanism in my application, and it works perfectly. WebClient does request, and waits, because server is creating response(file). If WebClient downloads 0kb that means that server responded to request with some empty response. This may not be a bug, but a design. If creating file takes long time, this method could result in timeouts. On the other hand if creating file takes short time, server side should respond with file(making WebClient hang on request, till the file is ready). I would try to discuss this matter with other developers and maybe redesign “file generator”.

    EDIT: Pooling means making requests in loop, for example every 2 seconds. I’m using DownloadData because it’s useless, and resource consuming, to save empty file every time, which DownloadFile does.

            public void PoolAndDownloadFile(Uri uri, string filePath)
            {
                WebClient webClient = new WebClient();
                byte[] downloadedBytes = webClient.DownloadData(uri);
                while (downloadedBytes.Length == 0)
                {
                    Thread.Sleep(2000);
                    downloadedBytes = webClient.DownloadData(uri);
                }
                Stream file = File.Open(filePath, FileMode.Create);
                file.Write(downloadedBytes, 0, downloadedBytes.Length);
                file.Close();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to download one file from an url that i give from an
I need to download a file from http://nppes.viva-it.com/NPI_Files.html , the problem is that every
I need to download file from FTP server and make some changes on it
I need to use a DLL file from qsBarcode http://www.qsbarcode.de/en/index.htm (here is the download
I need to download a zip archive of text files, dispatch each text file
I need to download a file using PHP and then after that upload the
by using web services we are able to download file from cloud to buffer
I need to download images from other websites to my server. Create a ZIP
I've created a page that allows users to download a file when they click
I need to download a zip file and unpack it, in the background (in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.