Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

problem with url on http post

Question posted by: CindyH (Guest) on June 27th, 2008 07:20 PM
Hi:

I have the following code:

Dim url As String = "http://xx01xx01:800/some.ashx"
Dim myrequest As System.Net.WebRequest = Nothing
Dim myresponse As System.Net.WebResponse = Nothing
'Prepare web request
myrequest = System.Net.WebRequest.Create(url)
'use POST
myrequest.Method = "POST"
'Set the content type
Request.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() =
System.Text.Encoding.UTF8.GetBytes(dataToPost)
'Get length of content
myrequest.ContentLength = byteArray.Length
'Get request stream
Dim newStream As System.IO.Stream = myrequest.GetRequestStream
'Send the data.
newStream.Write(byteArray, 0, byteArray.Length)
' Close stream
newStream.Close()
'Send the Post request and wait for the response.
myresponse = myrequest.GetResponse()

If I use for the first line something like this:
Dim url As String = "http://www.someplace.com/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.Stream = myrequest.GetRequestStream - I'm
getting the following error:
system.net.webexception: 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


Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:20 PM
#2

Re: problem with url on http post
CindyH wrote:
Quote:
Dim url As String = "http://www.someplace.com/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.Stream = myrequest.GetRequestStream - I'm
getting the following error:
system.net.webexception: 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?


Is other software on your system able to resolve the host name xx01xx01?
The host name needs to be resolved into a numerical IP address and that
fails for 'xx01xx01'. This is a network configuration problem and not an
XML problem.



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

CindyH's Avatar
CindyH
Guest
n/a Posts
June 27th, 2008
07:20 PM
#3

Re: problem with url on http post
The guy gave me the wrong url address.
Now I'm able to send the post, but response is empty and getting this error:
system.net.webexception: The remote server returned an error: (500) Internal
Server Error.
Would this be my problem or his?
Thanks,
Cindy



"Martin Honnen" <mahotrash@yahoo.dewrote in message
news:%23RT%23bXcuIHA.5096@TK2MSFTNGP02.phx.gbl...
Quote:
CindyH wrote:
>
Quote:
> Dim url As String = "http://www.someplace.com/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.Stream = myrequest.GetRequestStream - I'm
>getting the following error:
>system.net.webexception: 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?

>
Is other software on your system able to resolve the host name xx01xx01?
The host name needs to be resolved into a numerical IP address and that
fails for 'xx01xx01'. This is a network configuration problem and not an
XML problem.
>
>
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/




 
Not the answer you were looking for? Post your question . . .
189,876 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors