May 30th, 2006, 08:11 PM
#1
[RESOLVED] FTP Logon Issue
Using the Internet and FTP APIs I am opening a ftp connection and logging into a site but it doesnt work when done via code so I tried manually. I get this dialog error...
What is the issue?
VB Code:
Private Sub TransmitMe()
Dim hConnection As Long
Dim hOpen As Long
Dim sOrgPath As String
Dim lRet As Long
'open an internet connection
hOpen = InternetOpen("Test", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
'connect to the FTP server
hConnection = InternetConnect(hOpen, "subdomain.example.com", INTERNET_DEFAULT_FTP_PORT, "VB-Guru", "Meow", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
'create a buffer to store the original directory
sOrgPath = String(MAX_PATH, 0)
'get the directory
FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)
'set the current directory to 'root/Incoming
FtpSetCurrentDirectory hConnection, "Incoming"
'upload the file 'test.htm'
lRet = FtpPutFile(hConnection, ByVal "C:\Test.txt", "Test.txt", FTP_TRANSFER_TYPE_BINARY, 0)
If lRet = 1 Then
'
Else
'
End If
'close the FTP connection
InternetCloseHandle hConnection
'close the internet connection
InternetCloseHandle hOpen
End Sub
Attached Images
Last edited by RobDog888; Jun 1st, 2006 at 01:03 AM .
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
May 30th, 2006, 09:21 PM
#2
PowerPoster
Re: FTP WebDAV
try this:
VB Code:
hConnection = InternetConnect(hOpen, "[hl]ftp://[/hl]subdomain.example.com", INTERNET_DEFAULT_FTP_PORT, "VB-Guru", "Meow", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
ftp sites usually start with ftp:// at the beginning to indicate to the server that you are wanted to use the FTP service via the relevant port.
your screen capture didnt get the ftp domain by the looks of it.
May 30th, 2006, 11:00 PM
#3
Re: FTP WebDAV
I edited it out
I tried the IP address too and still nothing. Does the InternetOpen API need something in the first argument for the user agent? I just supplied a test string.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
May 30th, 2006, 11:04 PM
#4
Re: FTP WebDAV
A little farther now. I used the IP of the subdomain and this ShowError sub.
Seems the username is valid but the password is invalid.
VB Code:
Public Sub ShowError()
Dim lErr As Long, sErr As String, lenBuf As Long
'get the required buffer size
InternetGetLastResponseInfo lErr, sErr, lenBuf
'create a buffer
sErr = String(lenBuf, 0)
'retrieve the last respons info
InternetGetLastResponseInfo lErr, sErr, lenBuf
'show the last response info
If Len(CStr(lErr)) > 0 Then
MsgBox "Error " + CStr(lErr) + ": " + sErr, vbOKOnly + vbCritical
End If
End Sub
Attached Images
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
May 31st, 2006, 04:32 AM
#5
Re: FTP WebDAV
In the InternetOpen API the first argument is the agent. What is it used for and does it matter?
API definition of the argument:
lpszAgent
Address of a string that contains the name of the application or entity calling the Internet functions (for example, Microsoft Internet Explorer). This name is used as the user agent in the HTTP protocol.
Since I'm using FTP it wont matter, correct?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
May 31st, 2006, 06:12 AM
#6
PowerPoster
Re: FTP WebDAV
if youre not using an FTP client, then you need to use a browser to get to the FTP server.
May 31st, 2006, 04:00 PM
#7
Re: FTP WebDAV
Just got verification that the password is correct.
I tried using the API and still nothing. I tried using IE and thats where I get the WebDAV dialog error.
Arrrg.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jun 1st, 2006, 01:03 AM
#8
Re: FTP Logon Issue
Anyone have a FTP site that I can test this out on? You can PM me with the specifics.
The InternetOpen API is where I am having the issue.
VB Code:
hConnection = InternetConnect(hOpen, "xxx.xxx.xxx.xxx", INTERNET_DEFAULT_FTP_PORT, "UserName", "Password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jun 1st, 2006, 11:44 AM
#9
Re: [RESOLVED] FTP Logon Issue
WOOT! Finally got it connecting.
Made a looooong distance call and it turns out that the ftp site is running on a unix box so the username needed to be lower case and the password stays as case sensitive.
Dont need the asprins anymore
Thanks for the help BrailleSchool.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jun 1st, 2006, 12:00 PM
#10
Re: [RESOLVED] FTP Logon Issue
Using your code (after I found all the declares and constants ), and a valid account login, I have no problem logging in and uploading a file.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Jun 1st, 2006, 12:00 PM
#11
Re: [RESOLVED] FTP Logon Issue
Took me so long to get it working that you had it figured out before I posted.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Jun 1st, 2006, 12:14 PM
#12
Re: [RESOLVED] FTP Logon Issue
You should have posted or PM'd me.
I tested it on my windows server and it worked so I knew something was up specifically with the receiving site.
I also found that they wanted the file(s) in a particular folder structure dependinng on certain conditions.
I sure hate it when proper documentation is not provided
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jun 1st, 2006, 01:08 PM
#13
Re: [RESOLVED] FTP Logon Issue
Originally Posted by
RobDog888
You should have posted or PM'd me.
I wanted to be sure that it was or wasn't something with your code before I said anything, and finding all the APIs and declares took me a while.
I tested it on my windows server and it worked so I knew something was up specifically with the receiving site.
That's why I always assume *nix. Windows accepts *nix logins, but not the other way around. It's also why I stay away from uppercase letters in names of files that'll be publicly accessible.
I sure hate it when proper documentation is not provided
That's part of the fun - figuring out why a poorly documented function isn't working. You learn more that way than by reading the docs.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Jun 1st, 2006, 01:40 PM
#14
Re: [RESOLVED] FTP Logon Issue
Not when they say ...
[Them] "This is the correct username and password. Use exact casing. It must be your c0d."
[Robdog] "I am and I have attached a screen shot of the exact error message."
[Them "almost a week later"] Oh we are running a unix box so you need to change the username to all lower casing."
[RobDog] DOH!!!!!!!!!
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width