Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2004, 01:00 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webrequest ?? Any equiv. for xmlhttppost in .net??

I have given up hope. I was doing a simple xmlhttppost in ASP and it was working as smooth as butter. Now I am trying to do the same in dotnet and it is creating all the problems. I am trying to use the WebRequest class. And I keep getting a standard error - "The underlying connection was closed: The remote name could not be resolved. "

I have tried using byte arrays, xml and what not, but the error remains - "The underlying connection was closed: The remote name could not be resolved. "

Does this have anything to do with the URL to which I am posting? If it is a java servlet do I have to do something extra? The code i am doing is below. And I am nearly giving up on that. Any response will be greatly appreciated.

Dim xmlRequest As System.Net.WebRequest
        Dim xmlResponse As System.Net.HttpWebResponse
        Dim strm As System.IO.Stream
        Dim strmReader As System.IO.StreamReader
        Dim xmlDoc As System.Xml.XmlDocument

        xmlRequest = System.Net.HttpWebRequest.Create("url here")

        xmlRequest.ContentType = "text/xml"
        'xmlRequest.Accept = "text/xml"
        xmlRequest.Method = "POST"


        xmlDoc = New System.Xml.XmlDocument
        xmlDoc.Load(Server.MapPath("xml path here"))
        'Dim byteArray As Byte() = Encoding.ASCII.GetBytes(xmlDoc.InnerXml)
        'xmlRequest.ContentLength = byteArray.Length

        strm = xmlRequest.GetRequestStream()
        'strm.Write(byteArray, 0, xmlDoc.InnerXml.Length)

        xmlDoc.Save(strm)
        strm.Close()
        xmlResponse = xmlRequest.GetResponse()
        strm = xmlResponse.GetResponseStream()
        strmReader = New System.IO.StreamReader(strm)
        Response.Write(strmReader.ReadToEnd())

Thanks in advance.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with XMLHttpPost using incorrect values monkeymagix Ajax 1 June 2nd, 2008 07:14 PM
invoke webmethod using System.Net.WebRequest veeruu .NET Web Services 2 November 27th, 2007 12:47 AM
Error with Webrequest mike_remember ASP.NET 1.0 and 1.1 Professional 5 October 17th, 2006 08:01 AM
Is there a .NET Equiv for VB6 Debug.Assert? BrianWren VB.NET 2002/2003 Basics 1 May 17th, 2005 12:45 PM
Visual Studio deleting meta http-equiv DSJ27FD VS.NET 2002/2003 2 November 1st, 2003 11:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.