tags:

views:

36

answers:

0

I have created website on my local machine which will render a file to a client using Response.OutputStream.Write. The client is a Windows Forms application which uses BITS and specifies the website URL which I have created for file download, for example:

job.Files.Add("http://localhost/GetDocOffline2_1/Default.aspx?func=ll&objid=6132505&objaction=Open", @"C:\Temp\test2.xlsx");

When the URL is accessed the end result is a .xlsx file rendered in httpContext.Response.OutputStream.Write.

The problem I face is that BITS is able to download the file but keeps querying the URL for the number of headers I have set in the Response, i.e., I have set response headers, Content-length, Content-Disposition, etc.

Since the file is there in the ResponseStream the first time itself how can I prevent BITS from hitting the website so many times? I have also set the priority of the job as "foreground" since I get the error saying the "server does not support necessary http protocol".