WebDav with HttpRequest
Hi,
I wrote an application(VB.Net) with XmlHttp object (COM) to do some
operations in the exchange server. This application works fine. Now , I want
to write the same application with HttpRequest(.Net) instead of XmlHttp, but
always When I try to get a response from a query, I get the following error :
The remote sever returned an error:(404) Not Found.
Here some lines of the application:
'***** Save the attachment *******
' sUrlAttach is the url of an attachment in the exchange
Dim myreq As Net.HttpWebRequest = Net.WebRequest.Create(sUrlAttach)
myreq.Method = "GET"
myreq.Credentials = New System.Net.NetworkCredential("****", "*****")
' The error occures after this line :
Dim o_resp As Net.WebResponse = myreq.GetResponse()
Dim instream As Stream = o_resp.GetResponseStream()
Dim sr As StreamReader = New StreamReader(instream)
Dim sResp As String = sr.ReadToEnd()
Dim fs As New FileStream("C:\" & attchFileName, FileMode.Create)
Dim w As New StreamWriter(fs)
w.Write(sResp)
w.Close()
fs.Close()
Like I wrote before, This is just one example ,and I have this problem with
others querys too.
Thanks,
David
date: Sun, 23 Dec 2007 07:33:41 -0800
author: DavidE