Getting 404 Not Found connecting to webDAV
Posted
by Cragly
on Stack Overflow
See other posts from Stack Overflow
or by Cragly
Published on 2010-04-27T08:13:02Z
Indexed on
2010/04/27
8:53 UTC
Read the original article
Hit count: 284
I am trying to connect to a secure webDAV folder and download a file. I am having problems just trying to get a response from the server and as it keeps giving me a 404 Not Found error as soon as I call Request.GetResponse(). I can connect to the webDAV folder using Windows Explorer by mapping a drive but cannot seem to do this in code. I have looked at other post on this site and others online but most seem to concentrate on connecting to Outlook. Has anybody else had this issue? The code I am using is as follows:
string URI = "https://transfer.mycompany.com/myDirectory/myFile.csv";
string username = "username";
string password = "password";
Request = (HttpWebRequest) WebRequest.Create(URI);
Request.Credentials = new NetworkCredential(username, password);
Request.Method = WebRequestMethods.Http.Get;
Request.Headers.Add("Translate", "f");
Response = (HttpWebResponse) Request.GetResponse();
contentLength = Convert.ToInt64(Response.GetResponseHeader("Content-Length"));
© Stack Overflow or respective owner