Link to home
Start Free TrialLog in
Avatar of derjim929
derjim929

asked on

wininet.dll's FTP deletefile function

I've been using wininet.dll to retrieve FTP files from an IIS server without any problem. But if I use it to delete FTP files, I get a successful return message (or no error message) but the files are not deleted. Though the FTP files are still there, it behaves that it has been 'locked' up that you can't do anything with it anymore.

I try to delete it again or move it using different FTP utilities (WS, CuteFTP, FTP in the command prompt) I couldn't delete or move it anymore I get a 'no permission error'. Even if i try to login interactively on the IIS server using an Admin account and try to delete from the servers local drive, I still can't delete or move it.

My only workaround is to restart the server and delete it again from the server's local drive.

My FTP account has sufficient rights to delete the FTP file because I can delete the file with different FTP utilities before it gets 'locked' by wininet.dll' deletefile function.

I'm using VB6 on NT4 Workstation SP6 as my client, the IIS server is an NT4 Server (i believe it has SP5 or SP6). I would really appreciate it if someone can tell me a solution for this and perhaps explain to me why its happening.
Avatar of bppraveen001
bppraveen001

Hello derjim929,
     I wrote my own FTP application by using INet Control and I had the same problem as you are facing, I overcome that problem by using the following code: (StillExecuting is a property of INet control which indicates wheather the INet control is still executing the old command or is it ready to execute next command)

     Private Sub Wait()
          Do While Inet1.StillExecuting
               DoEvents
          Loop
     End Sub

      In the above function I am looping till the StillExecuting property has "True" value.

      I think if you do the same thing it will work....

       Why you need to do is, when ever you issue any commands to the FTP server to do it takes some time. If we don't call the above function after issuing some of the FTP commands (like Upload, Download, Delete etc.,), our application will execute remaining line of code for that we feel as if everything is worked fine, but it need some time to perform fully. When ever FTP is dealing with any particular file it will not allow any other FTP application to access that file till it completes the task (basically like Session Variables in ASP till that session is over it will not allow you to access that file after the session time is over you can do what ever you want) , by this time you are trying to delete the same file by using some other FTP application and it is unable to delete the file and throwing the error.

bpp
Avatar of DanRollins
Hi derjim929,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

derjim929, Please DO NOT accept this comment as an answer.
    **** if bppraveen001's suggestion worked, accept IT as an answer
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial