I am trying to create directory on server via https. But while returning the response it generates exceptions: “The remote server returned an error: (404) Not Found.”
The code is as follows:
string szURL3 = @"https://directoryurl/TestDir/";
//Create an HTTP request for the URL.
HttpWebRequest httpMkColRequest = (HttpWebRequest)WebRequest.Create(szURL3);
// Set up new credentials.
httpMkColRequest.Credentials = new NetworkCredential(_httpsUserName, _httpsPassword);
// Pre-authenticate the request.
httpMkColRequest.PreAuthenticate = true;
// Define the HTTP method.
httpMkColRequest.Method = @"MKCOL";
// Retrieve the response.
HttpWebResponse httpMkColResponse = (HttpWebResponse)httpMkColRequest.GetResponse();
//Write the response status to the console.
Console.WriteLine(@"MKCOL Response: {0}",httpMkColResponse.StatusDescription);
Could anybody support regarding this. I am able to get the directory information correctly in the same way. As I referred some links:
http://blogs.msdn.com/b/robert_mcmurray/archive/2011/10/18/sending-webdav-requests-in-net-revisited.aspx
According to this, what I understood is that the resources are locked. But how to unlock the resources for creating directory.
Please correct where modification required.
Solutions1
I solved the issue. The webDAV Configuration on the server was not enabled.
Talk1:
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
Talk2:
The webDAV Configuration was not correct due to that reason, different kinds of exception were generated for the different methods.