Copy File using WebDAV

Copy File using WebDAV

Post by vishu9 » Sat, 24 Jan 2004 22:55:19


Hi

Can anybody plz tell me how to copy files using WebDAV. I want to copy files
go.asp from my localpath http://servername/webdav/go.asp to
http://servername/exchange/administrator/foldername/go.asp
It gives me error saying " The remote server returned an error: (403)
Forbidden".

and here is my code

Dim Request As System.Net.HttpWebRequest

Dim httpResponse As System.Net.HttpWebResponse

Dim MyCredentialCache As System.Net.CredentialCache

Request = CType(System.Net.WebRequest.Create(strSrcURI), _

System.Net.HttpWebRequest)

' Add the network credentials to the request.

'Request.Credentials = System.Net.CredentialCache.DefaultCredentials

Request.Credentials = System.Net.CredentialCache.DefaultCredentials

' Specify the method.

Request.Method = "COPY"

' Set the Destination URI.

Request.Headers.Add("Destination", strDestURI)

' Specify that if a resource already exists at the

' destination URI, it will not be overwritten. The

' server would return a 412 Precondition Failed status code.

Request.Headers.Add("Overwrite", "F")

' Send the COPY method request and get the

' response from the server.

httpResponse = Request.GetResponse()