views:

29

answers:

3
string filePath = "C:\\test\\564.flv";
try
{
    WebClient client = new WebClient();

    NetworkCredential nc = new NetworkCredential(uName, password);

    Uri addy = new Uri("\\\\192.168.1.28\\Files\\test.flv");
    client.Credentials = nc;
    byte[] arrReturn = client.UploadFile(addy, filePath);
    Console.WriteLine(arrReturn.ToString());
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

i am get this error "The remote server returned an error: (405) Method Not Allowed." what should i doo ??

A: 

WebClient uses POST method to upload a file in an HTTP server or uses STOR command to upload a file in an FTP server. It can't upload files in a network folder.

kgiannakakis
A: 

I do not believe the UploadFile() method can have a UNC address for the URI. See the documentation for the method: http://msdn.microsoft.com/en-us/library/ms144229.aspx. It needs to either be an FTP site or an HTTP site.

NYSystemsAnalyst
A: 

so any buddy give me another solution ??