tags:

views:

468

answers:

2

I am using httpresponse.Transmitfile to download files. If I, in the file download dialog, choose to save in a different folder than the suggested one, the download rate drops down to 10 - 20 kb. If I cancel, or always choose to download in the same folder, then transfer rate are 200 kb and more. Here are my code :

procedure TDefault.LastNedBilde(strURL: string);  
var  
 Outfil: FileInfo;  
begin  
   Outfil:= FileInfo.Create(Server.MapPath(strUrl) );  
   response.Clear();  
   response.ClearContent();  
   response.ClearHeaders();  
   response.Buffer := True;  
   response.ContentType :='image/tiff';  
   response.AddHeader('Content-Disposition',  
                     'attachment; filename=' + filename;');  
   response.AddHeader('Content-Length', Outfil.Length.ToString());  
   response.Transmitfile(strUrl,0,Outfil.Length);  
   response.Flush();  
   response.&End;  
end;

This is written in RadStudio 2007, Delphi for .Net. Have anybody experienced anything like this ? This is not a problem in Opera or Firefox, only internet explorer.

+1  A: 

The server does not know where the user saves the file, so the server-code is not what is causing this.

Could it be that your browser is caching the file, and then if you save it again to the same location, it only uses the cached version and does not download from the server? Try to save the file to the same (but another) directory two times in a row, and see if the second try gets a higher download rate.

Espo
A: 

The second one does not get higher download rate, its the same slow.

Maybe internet explorer only caches saves to the default directory? If you clean your browser cache in firefox, will it download with 200KB/s to the alternative location on the first try?
Espo