473,394 Members | 1,935 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,394 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
4 2209
the error means the dns lookup on the requested server name did not return an
ipaddress. check which dns server you web server uses.

-- bruce (sqlwork.com)
"CindyH" wrote:
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 #2
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:Or**************@TK2MSFTNGP03.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 #3
Not really possible to know. Either you provided incorrect data, either
there is something wrong server side for the valid data you provided....

You can't do much more than double checking you provided good data (possibly
a sample case provided by this guy and that works would be fine for testing)
before getting in touch with the third party...

As a side note, you may want to check WebClient that will encode form data
for you (you just have to provide pairs of values). For some reason it looks
like I often see code that prefer to use the lowest level API even when not
really needed (to avoid having to swtich if you alter really need it ?)...

Also a classic problem is not providing a user agent string or any other
http header that is used by the server side page...

--
Patrice
"CindyH" <ch*******@new.rr.coma écrit dans le message de groupe de
discussion : #4*************@TK2MSFTNGP02.phx.gbl...
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:Or**************@TK2MSFTNGP03.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
Ok, thanks.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:D0**********************************@microsof t.com...
Not really possible to know. Either you provided incorrect data, either
there is something wrong server side for the valid data you provided....

You can't do much more than double checking you provided good data
(possibly a sample case provided by this guy and that works would be fine
for testing) before getting in touch with the third party...

As a side note, you may want to check WebClient that will encode form data
for you (you just have to provide pairs of values). For some reason it
looks like I often see code that prefer to use the lowest level API even
when not really needed (to avoid having to swtich if you alter really need
it ?)...

Also a classic problem is not providing a user agent string or any other
http header that is used by the server side page...

--
Patrice
"CindyH" <ch*******@new.rr.coma écrit dans le message de groupe de
discussion : #4*************@TK2MSFTNGP02.phx.gbl...
>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:Or**************@TK2MSFTNGP03.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 #5

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.