473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with url on http post

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
Jun 27 '08 #1
6 982
On May 19, 10:18*am, "CindyH" <chensc...@new.rr.comwrote:
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
From the machine that is running the code, are you able to Ping or
Tracert to the actual FQDN? Is port 800 open on the remote server or
is a firewall blocking this port? Are you able to telnet to the
address including the port?

Larry
Jun 27 '08 #2
On 19 Mayıs, 18:18, "CindyH" <chensc...@new.rr.comwrote:
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
Hi,
Are you sure that you want to connect remote host using port 800
instead of 80? Http uses 80 by default.

And make sure url is valid and healty of course.(xx01x01 doesn't make
sense as a valid http domain without com or net or org... extension
alone)

Thanks,

Onur
Jun 27 '08 #3
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

"CindyH" <ch*******@new.rr.comwrote in message
news:uf**************@TK2MSFTNGP06.phx.gbl...
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


Jun 27 '08 #4
On May 19, 10:41*am, "CindyH" <chensc...@new.rr.comwrote:
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

"CindyH" <chensc...@new.rr.comwrote in message

news:uf**************@TK2MSFTNGP06.phx.gbl...
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- Hide quoted text -

- Show quoted text -
Normally you can get the exact 500 error when going to the URL
directly via a web browser. This will give you a better idea of what
the 500 internal error message is.

Larry
Jun 27 '08 #5

"kimiraikkonen" <ki*************@gmail.comschreef in bericht
news:2f**********************************@m73g2000 hsh.googlegroups.com...
On 19 Mayıs, 18:18, "CindyH" <chensc...@new.rr.comwrote:
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
Hi,
Are you sure that you want to connect remote host using port 800
instead of 80? Http uses 80 by default.

And make sure url is valid and healty of course.(xx01x01 doesn't make
sense as a valid http domain without com or net or org... extension
alone)

Thanks,

Onur
Http uses 80 by default
normally 8080 is also open in the firewall because of corporate proxy
servers
Michel .


Jun 27 '08 #6
On May 19, 10:12*pm, "Michel Posseth [MCP]" <M...@posseth.comwrote:
"kimiraikkonen" <kimiraikkone...@gmail.comschreef in berichtnews:2f**********************************@m 73g2000hsh.googlegroups.com...
On 19 Mayıs, 18:18, "CindyH" <chensc...@new.rr.comwrote:


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

Hi,
Are you sure that you want to connect remote host using port 800
instead of 80? Http uses 80 by default.

And make sure url is valid and healty of course.(xx01x01 doesn't make
sense as a valid http domain without com or net or org... extension
alone)

Thanks,

Onur
Http uses 80 by default

normally 8080 is also open in the firewall because of corporate proxy
servers

Michel .- Hide quoted text -

- Show quoted text -
Yes, but IE and most of browsers assume port 80 to connect the remote
host unless you specify other port like 8080 or another.

"http://www.google.com" works and "http://www.google.com:80" works
also.

Thanks,

Onur Güzel
Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
8
by: Bob Skutnick | last post by:
Greetings, I'm hoping someone has experienced a problem I'm having: I have an existing ASP application (working fine) that uses an SSL server certificate. My user community is made up of both...
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
1
by: gerry | last post by:
Hi, although this is not strictly asp.net related, I was hoping that someone could confirm or debunk what appears to be a major problem with safari POSTs. with the following html : <!DOCTYPE...
43
by: balakrishnan.dinesh | last post by:
Hi all, Im working in javascript, I want to use Ajax in javcascript, Can u tel me how to use ajax in javascript, whether i have to include any code as like to include *css or *.js file, what are...
3
by: Jon L | last post by:
Hi, I'm hoping someone can help me with this problem. I'm not sure whether the problem lies with the software or with my understanding of the language. I'm using the Microsoft.XMLDOM object...
7
by: Inny | last post by:
Hello again, Im using the code below in a child page (popup), the images are called from the parent page. When the changer is running, the child page goes white between images. I realise this is...
4
by: CindyH | last post by:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.