"Ching-Lung" wrote:
Hi,
UploadFile() is always throwing WebException: "The remote
server returned an error: (405) Method Not Allowed."
I guess that is WebClient.UploadFile(). Well, if you don't specify the
HTTP verb, it will post the file. In that case, there must be some web
application handling the file upload -- which seems not to be case here.
For a "pure" (no web app) HTTP file upload, try HTTP PUT:
string url = "http://host/vdir/test.txt";
WebClient client = new WebClient();
byte[] response = client.UploadFile(url, "PUT", @"C:\temp\test.txt");
This requires write permissions on the virtual directory "vdir".
Cheers,
--
Joerg Jooss
jo*********@gmx.net