Home All Groups Group Topic Archive Search About

My.Computer.Network.UploadFile error

Author
24 Nov 2006 10:51 PM
John Brown
THE FOLLOWING CODE:

Dim strUpLoadFile As String
Dim siteUri As New Uri("ftp://wxyz.com/UpLdTest.zip")
strUpLoadFile = "C:\Trash\UpLdTest.zip"
My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg",
1000)

PRODUCES THIS ERROR:

Unable to cast object of type 'System.String' to type
'System.Net.ICredentials'.

THE ERROR POINTS TO THE USERNAME PARAMATER AS THE SOURCE OF THE ERROR. I'M
GUESSING THE PASSWORD PARAMETER WOULD PRODUCE AN ERROR ALSO.
WHAT IS THE CORRECT CODE TO UTILIZE My.Comp....work.UploadFile?
Thanks for your help.
--
John Brown

Author
24 Nov 2006 11:16 PM
Leon Mayne
"John Brown" wrote:
> My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg",
> 1000)

The specified signature you're using doesn't exist, you're trying to use:
sourceFileName ,address ,userName ,password, connectionTimeout
but the only two close signatures are either:
sourceFileName ,address ,userName ,password
or
sourceFileName ,address ,networkCredentials ,showUI ,connectionTimeout

..NET thinks you're using the latter, and so thinks your username should be
of type ICredentials.

Remove the last parameter from your call:
My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg")
Author
27 Nov 2006 9:14 PM
John Brown
Thanks Leon, I think that will make it work.

--
John Brown


Show quoteHide quote
"Leon Mayne" wrote:

> "John Brown" wrote:
> > My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg",
> > 1000)
>
> The specified signature you're using doesn't exist, you're trying to use:
> sourceFileName ,address ,userName ,password, connectionTimeout
> but the only two close signatures are either:
> sourceFileName ,address ,userName ,password
> or
> sourceFileName ,address ,networkCredentials ,showUI ,connectionTimeout
>
> .NET thinks you're using the latter, and so thinks your username should be
> of type ICredentials.
>
> Remove the last parameter from your call:
> My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg")
>