Wrote a code to upload file to a https folder as below
WebClient webClient = new WebClient();
string webAddress = null;
try
{
webAddress = @"https://www.example.net/mydocs";
webClient.UseDefaultCredentials = true;
webClient.Credentials = CredentialCache.DefaultCredentials;
WebRequest serverRequest = WebRequest.Create(webAddress);
WebResponse serverResponse;
serverResponse = serverRequest.GetResponse();
serverResponse.Close();
webClient.UploadFile(webAddress , "PUT", @"C:\d\1.xml");
webClient.Dispose();
webClient = null;
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}
the line webClient.UploadFile(webAddress , "PUT", @"C:\d\1.xml");
returning an error
The remote server returned an error: (405) Method Not Allowed.