httpwebrequest error

G

Guest

Can someone tell me why I keep getting the following error when trying issue
a web request thru VB.Net windows application. This was sample code for
using web request but I’m getting it on my code as well.
ERROR MSG: An unhandled exception of type
'System.Configuration.ConfigurationException' occurred in system.dll

VB Code:
Dim myHttpWebRequest As HttpWebRequest

myHttpWebRequest =
CType(WebRequest.Create("http://www.w3coder.com/contest/examples/WSObjMultiArr.asmx/TestObjSerilizer"), HttpWebRequest)

Dim myHttpWebResponse As HttpWebResponse =
CType(myHttpWebRequest.GetResponse(), HttpWebResponse)

Dim receiveStream As Stream = myHttpWebResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(receiveStream, encode)

Debug.WriteLine(readStream.ReadToEnd())
readStream.Close()
myHttpWebResponse.Close()
 
J

Joerg Jooss

Thus wrote Logger,
Can someone tell me why I keep getting the following error when trying
issue a web request thru VB.Net windows application. This was sample
code for using web request but I’m getting it on my code as well.
ERROR MSG: An unhandled exception of type
'System.Configuration.ConfigurationException' occurred in system.dll

VB Code:
Dim myHttpWebRequest As HttpWebRequest
myHttpWebRequest =
CType(WebRequest.Create("http://www.w3coder.com/contest/examples/WSObj
MultiArr.asmx/TestObjSerilizer"), HttpWebRequest)

Dim myHttpWebResponse As HttpWebResponse =
CType(myHttpWebRequest.GetResponse(), HttpWebResponse)

Dim receiveStream As Stream = myHttpWebResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8") Dim
readStream As New StreamReader(receiveStream, encode)

Debug.WriteLine(readStream.ReadToEnd())
readStream.Close()
myHttpWebResponse.Close()

Are you sure it's caused by this code? I'd rather suspect your app.config...

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top