Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / May 2008

Tip: Looking for answers? Try searching our database.

problem with url on http post

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CindyH - 19 May 2008 16:19 GMT
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 - 19 May 2008 16:34 GMT
>  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
[quoted text clipped - 5 lines]
> 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.

Signature

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

CindyH - 19 May 2008 16:42 GMT
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

>>  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
[quoted text clipped - 11 lines]
> fails for 'xx01xx01'. This is a network configuration problem and not an
> XML problem.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.