using File.Copy to copy files to shared hosting site

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
 
W

Wessel Troost

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
 
S

Steve Richter

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
 
W

Wessel Troost

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top