snufse
-
Total Posts
:
36
- Scores: 0
-
Reward points
:
0
- Joined: 9/6/2007
-
Status: offline
|
FTP does not execute
Friday, August 20, 2010 8:57 AM
( permalink)
When application executes I cannot see any script being run in the command prompt windows. Public Sub Build_FTP_Command_String() objFSO = Server.CreateObject("Scripting.FileSystemObject") objTextFile = objFSO.CreateTextFile("c:\temp\ftpfile6.txt", True) objTextFile.WriteLine("open " & strHost) objTextFile.WriteLine(strLoginId) objTextFile.WriteLine(strPassWord) objTextFile.WriteLine(strMode) objTextFile.WriteLine("prompt on") objTextFile.WriteLine("put " & strLocalFolder & strFilePut & " " & strRemoteFolder) objTextFile.WriteLine("quit") End Sub Public Sub Execute_FTP_Process() objShell = CreateObject("WScript.Shell") objShell.Exec(cmdFTP & Chr(34) & "c:\temp\ftpfile6.txt" & Chr(34)) objFSO = Nothing objTextFile = Nothing objFSO = Nothing End Sub
|
|
|
|
ehvbs
-
Total Posts
:
3320
- Scores: 112
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
Re:FTP does not execute
Saturday, August 21, 2010 6:43 AM
( permalink)
|
|
|
|
snufse
-
Total Posts
:
36
- Scores: 0
-
Reward points
:
0
- Joined: 9/6/2007
-
Status: offline
|
Re:FTP does not execute
Monday, August 23, 2010 1:54 AM
( permalink)
The Page_Load is calling the subs, I did not include it on purpose. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Build_FTP_Command_String() Execute_FTP_Process() End Sub Now when I neter the "Execute" sub I see a DOS screen but no scripts being run. Does my code seem correct? All my variables have values at this point. Thank you.
|
|
|
|
snufse
-
Total Posts
:
36
- Scores: 0
-
Reward points
:
0
- Joined: 9/6/2007
-
Status: offline
|
Re:FTP does not execute
Monday, August 23, 2010 2:35 AM
( permalink)
Now, seems like script is running fine and does the ftp to the remote machine. What I do not understand is why I do not see any commands being executed in the dos window since I have prompt = on? Also, how can I delete the text file created after ftp has completed? I am executing the DeleteFile command but getting error: objShell.Exec(cmdFTP & Chr(34) & "c:\temp\ftpfile6.txt" & Chr(34)) objFSO.DeleteFile("c:\temp\ftpfile6.txt") Error on objFso.DeleteFile ... System.Security.SecurityException: Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED) I thought if I could create a file I should also be allowed to delete same file or ???? Thank you.
<message edited by snufse on Monday, August 23, 2010 3:48 AM>
|
|
|
|
ehvbs
-
Total Posts
:
3320
- Scores: 112
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
Re:FTP does not execute
Monday, August 23, 2010 3:46 AM
( permalink)
If you zap objFSO, you can't use it later on. (Just shows that you shouldn't Set objects to Nothing for nothing) P.S. Get rid of the 'pass me by value ()' too.
<message edited by ehvbs on Monday, August 23, 2010 3:48 AM>
|
|
|
|
snufse
-
Total Posts
:
36
- Scores: 0
-
Reward points
:
0
- Joined: 9/6/2007
-
Status: offline
|
Re:FTP does not execute
Monday, August 23, 2010 4:11 AM
( permalink)
Thank you for the tip... Tried to work it this way: Public Sub Execute_FTP_Process() Try objShell = CreateObject("WScript.Shell") objShell.Exec(cmdFTP & Chr(34) & strFTPScriptFileName & Chr(34)) Dim file If objFSO.fileExists(strFTPScriptFileName) Then file = objFSO.GetFile(strFTPScriptFileName) file.Delete() End If objFSO = Nothing Catch ex As Exception Dim ErrorString As String ErrorString = ex.ToString Dim mystr As String = Finally End Try End Sub Still getting error on the file delete: System.Security.SecurityException: Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)
|
|
|
|
ehvbs
-
Total Posts
:
3320
- Scores: 112
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
Re:FTP does not execute
Monday, August 23, 2010 4:32 AM
( permalink)
Being a bit slow on the uptake, I realized but now, that we aren't talking VBScript. So disregard everything I wrote. (could one of the admins move this topic to the "Other Languages" forum, please)
|
|
|
|