using File.Copy to copy files to shared hosting site

  • Thread starter Thread starter Steve Richter
  • Start date Start date
S

Steve Richter

can File.Copy be use to copy files from my PC to the file system at my
shared hosting web site? If so, what is the format of the path name of
the file on the web site?

The idea being that if I login to my ftp site, any subsequent File.Copy
commands will not require server authentication.

this fails - invalid string format:
string source = "c:\\src#\\appl\\bin\\Debug\\orders.dll" ;
string dest = "ftp://[email protected]/WineStore/orders.dll" ;
System.IO.File.Copy( source, dest, true ) ;

this did not work either:
string source = "c:\\src#\\appl\\bin\\Debug\\orders.dll" ;
string dest = "//www.domain.com/WineStore/orders.dll" ;
System.IO.File.Copy( source, dest, true ) ;

thanks,
-Steve
 
string dest = "ftp://[email protected]/WineStore/orders.dll" ;

What happens when you put this string in the address bar of Windows
Explorer?

Explorer uses the same mechanism to connect to the site, so you should make
sure this works first.

By the way, you can use a password like this:
ftp:://user:p[email protected]

Greetings,
Wessel
 
Wessel said:
What happens when you put this string in the address bar of Windows
Explorer?

it works. only I have to leave off the file name at the end:
ftp://username:p[email protected]/WineStore/bin

IE does not like the back slash in the address bar however. Only
forward slash works for me.
Explorer uses the same mechanism to connect to the site, so you should make
sure this works first.

By the way, you can use a password like this:
ftp:://user:p[email protected]

this works, so I am sure the format of the from path is ok.
string source, dest ;
source = "c:\\src#\\abc\\bin\\Debug\\orders.dll" ;
dest = "c:\\src#\\abc\\bin\\Debug\\orders.dll" ;
System.IO.File.Copy( source, dest, true ) ;

this does not:
source = "c:\\src#\\abc\\bin\\Debug\\orders.dll" ;
dest = "ftp://username:p[email protected]/WineStore/bin/orders.dll"
;
System.IO.File.Copy( source, dest, true ) ;

here is the error:
System.NotSupportedException occured in mscorlib.dll
additional information: the given path's format is not supported

thanks for the help,
-Steve
 
the given path's format is not supportedMaybe it's telling you that the "FTP://" style URL is not supported in
..NET. At any rate, I found a KB article that explains FTP under .NET.
Perhaps it is of use to you, it certainly contains an alternative way of
transferring the file:

http://support.microsoft.com/?scid=kb;EN-US;832679

It does seem awfully complex.

Greetings,
Wessel
 
Back
Top