Markus,
I found the solution, and you are correct. It is the responsibility of the
client to also stream the data to the server. Unfortunately, Microsoft's
own article and sample code fail to mention this small fact, for some
reason.
I actually found an even simpler way to do these types of copy. ADO with
the Internet Publishing provider can handle it, and that's the method I
went with.
Thanks,
Shannon
"Markus Hahn" <markus_hahn@gmx.net> wrote in message
news:3RpSb.2662$uM2.651@newsread1.news.pas.earthli nk.net...[color=blue]
> I'm not sure, bu I think you must also stream the data up to the server.[/color]
But that's just a guess.[color=blue]
> If you're not sure what's happening behind the doors then I'd try a packet[/color]
sniffer and monitor the actual request going out - there[color=blue]
> you should see if your file data actually makes it over the wire. Try[/color]
www.ethereal.com for a nice freeware packet capture.[color=blue]
>
> -markus
>
>
> "Shannon Hardin" <shardin@alginc.com> wrote in message[/color]
news:unSMWKo5DHA.2008@TK2MSFTNGP10.phx.gbl...[color=blue][color=green]
> > I'm trying to build a routine that will take a specified file from the
> > user's local hard drive, and copy it to a remote server via WebDAV.[/color][/color]
I've[color=blue][color=green]
> > tried using both HttpWebRequest and FileWebRequest, as outlined in some
> > samples I found on MSDN and elsewhere, but so far have had no luck
> > whatsoever. The copy process doesn't fail, but neither does the[/color][/color]
targeted[color=blue][color=green]
> > file actually appear on the destination server. I have verified that I[/color][/color]
can[color=blue][color=green]
> > copy files manually to the target WebDAV folder, via a mapped network
> > resource on Windows XP. Word XP successfully loads and saves files to[/color][/color]
the[color=blue][color=green]
> > target folder as well.
> >
> > Here's the code I'm using:
> >
> > Dim MyResponse As HttpWebResponse
> > Dim MyCredentialCache = New System.Net.CredentialCache
> > Dim UserName As String = "MyUserName"
> > Dim Password As String = "MyPassword"
> > Dim Domain As String = "MyDomain"
> > Dim SourceURI As String = "http://localhost/text.xml"
> > Dim MyRequest As HttpWebRequest =[/color][/color]
CType(WebRequest.Create(SourceURI),[color=blue][color=green]
> > HttpWebRequest)
> >
> > Try
> >
> > MyCredentialCache.Add(New System.Uri(SourceURI), "NTLM", New
> > System.Net.NetworkCredential(UserName, Password, Domain))
> >
> > ' Add the network credentials to the request.
> > MyRequest.Credentials = MyCredentialCache
> > MyRequest.Headers.Add("Destination",
> > "http://DestinationServer/SubFolder/text.xml")
> > MyRequest.Headers.Add("Overwrite", "F")
> > MyRequest.Method = "COPY"
> > MyResponse = CType(MyRequest.GetResponse(), HttpWebResponse)
> > MyResponse.Close()
> >
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > End Try
> >
> > The status code contained in the response object will say "Created"[/color][/color]
every[color=blue][color=green]
> > time, but no actual file appears. I have also used a slightly modified
> > version of this code that uses FileWebRequest instead of HttpWebRequest,
> > with similar results. Essentially, in that case, the response object
> > contains a stream that appears to have all the data from the source file[/color][/color]
in[color=blue][color=green]
> > it, but the file itself never appears in the target folder. Any insight
> > would be greatly appreciated!
> >
> > Thanks,
> >
> > Shannon
> >
> >[/color]
>
>[/color]