Temp files

Dec 6, 2010 at 12:31 PM

Hi I'm using your lib for a service that looks for new media content on a server from the supplier.

The problem I'm having is everything that gets downloaded sticks around in %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5

any thoughts on this?

Thanks for the work, you've got the best ftp library out there

Coordinator
Dec 6, 2010 at 6:05 PM

Apparently wininet.dll uses whatever IE cache setting you have set in Internet Options. You can try adding a definition for INTERNET_FALG_DONT_CACHE to the WININET class :

 

public const int INTERNET_FLAG_DONT_CACHE =  0x04000000;

And then, change the FtpConnection.GetFile() method to this:

        public void GetFile(string remoteFile, string localFile, bool failIfExists)
        {
            int ret = WININET.FtpGetFile(_hConnect,
                 remoteFile,
                 localFile,
                 failIfExists,
                 WINAPI.FILE_ATTRIBUTE_NORMAL,
                 WININET.FTP_TRANSFER_TYPE_BINARY | WININET.INTERNET_FLAG_DONT_CACHE,
                 IntPtr.Zero);

            if (ret == 0)
            {
                Error();
            }
        }

Let me know if that works.

Dec 7, 2010 at 10:00 AM

Thanks Scott,

that worked perfectly

Cheers