Hi:
I have the following code:
Dim url As String = "http://xx01xx01:800/some.ashx"
Dim myrequest As System.Net.WebR equest = Nothing
Dim myresponse As System.Net.WebR esponse = Nothing
'Prepare web request
myrequest = System.Net.WebR equest.Create(u rl)
'use POST
myrequest.Metho d = "POST"
'Set the content type
Request.Content Type = "applicatio n/x-www-form-urlencoded"
Dim byteArray As Byte() =
System.Text.Enc oding.UTF8.GetB ytes(dataToPost )
'Get length of content
myrequest.Conte ntLength = byteArray.Lengt h
'Get request stream
Dim newStream As System.IO.Strea m = myrequest.GetRe questStream
'Send the data.
newStream.Write (byteArray, 0, byteArray.Lengt h)
' Close stream
newStream.Close ()
'Send the Post request and wait for the response.
myresponse = myrequest.GetRe sponse()
If I use for the first line something like this:
Dim url As String = "http://www.someplace.c om/somepage.aspx" then
everything works fine, but now I need to use the real address which is
something like this: "http://xx01xx01:800/some.ashx"
When the code hits the line:
Dim newStream As System.IO.Strea m = myrequest.GetRe questStream - I'm
getting the following error:
system.net.webe xception: The remote name could not be resolved: 'xx01xx01'
Does anyone have any ideas why I'm having problems with the stream for a url
address like this?
Thanks,
Cindy
I have the following code:
Dim url As String = "http://xx01xx01:800/some.ashx"
Dim myrequest As System.Net.WebR equest = Nothing
Dim myresponse As System.Net.WebR esponse = Nothing
'Prepare web request
myrequest = System.Net.WebR equest.Create(u rl)
'use POST
myrequest.Metho d = "POST"
'Set the content type
Request.Content Type = "applicatio n/x-www-form-urlencoded"
Dim byteArray As Byte() =
System.Text.Enc oding.UTF8.GetB ytes(dataToPost )
'Get length of content
myrequest.Conte ntLength = byteArray.Lengt h
'Get request stream
Dim newStream As System.IO.Strea m = myrequest.GetRe questStream
'Send the data.
newStream.Write (byteArray, 0, byteArray.Lengt h)
' Close stream
newStream.Close ()
'Send the Post request and wait for the response.
myresponse = myrequest.GetRe sponse()
If I use for the first line something like this:
Dim url As String = "http://www.someplace.c om/somepage.aspx" then
everything works fine, but now I need to use the real address which is
something like this: "http://xx01xx01:800/some.ashx"
When the code hits the line:
Dim newStream As System.IO.Strea m = myrequest.GetRe questStream - I'm
getting the following error:
system.net.webe xception: The remote name could not be resolved: 'xx01xx01'
Does anyone have any ideas why I'm having problems with the stream for a url
address like this?
Thanks,
Cindy
Comment