Using ASP .Net 2.0 w/VB in VS2005
I have been trying to get the weather xml to work on our intranet. When I test it, I get a "No connection could be made because the target machine actively refused it " error. I am able to go to the xoap site and view the xml data, but it won't retrieve it. Here's my code:
Imports System.IO
Imports System.Net
Imports System.Xml
Imports System.Xml.Xpath
Imports System.Configuration
Partial Class Default_aspx
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim url As String = "http://xoap.weather.com/weather/local/78207?cc=*&dayf=" & _
ConfigurationSettings.AppSettings.Get("ExtForecastLength") & _
"&prod=xoap&par=" & ConfigurationSettings.AppSettings.Get("PartnerID") & _
"&key=" & ConfigurationSettings.AppSettings.Get("LicenseKey")
' Creates an HttpWebRequest for the specified URL.
Dim wr As HttpWebRequest = CType(WebRequest.Create(url), System.Net.HttpWebRequest)
' Sends the request and waits for a response.
Dim resp As HttpWebResponse = CType(wr.GetResponse(), System.Net.HttpWebResponse)
' Calls the method GetResponseStream to return the stream associated with the response.
Dim str As System.IO.Stream = resp.GetResponseStream()
Dim reader As XmlTextReader = New System.Xml.XmlTextReader(str)
reader.XmlResolver = Nothing
' Create and load the XmlDocument.
Dim doc As XmlDocument = New System.Xml.XmlDocument()
doc.Load(reader)
Xml1.Document = doc
Xml1.TransformSource = "new.xslt"
End Sub
End Class
I have our ParnterID and LicenseKey store in the webconfig file.
Any help that you could provide would be greatly appreciated.
Matt