hi,
I have a function which reads the xml from a web url into the
XmlTextReader, and then I work my way through the reader producing
html from the different nodes. All the code works fine when I debug
the project, but when I publish the project and run it on a live
server, I seem to be getting problems.
I get the error:
A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond
My code is as follows:
Dim strURL As String = "http://www.nme.com/clubnmerss"
Dim sb As New StringBuilder()
Dim reader As New XmlTextReader(strURL)
reader.MoveToContent()
Dim sString2 As String = ""
Dim hasEnteredGig As Integer = 0
While reader.Read()
If reader.Name = "venue" Then
hasEnteredGig = 1
sString = sString.Replace("##G##", sString2)
sString2 = ""
Venue = reader.ReadString()
sString += "<div class='gig-box'><img src='media/liv/
club-nme.gif' /><br /></div>"
sString += "<div class='gig'><div class='basic-
headline'><h1>CLUB NME</h1></div>##G##</div>"
sString2 += "<h2>" & Venue & "</h2>"
End If
If reader.Name = "address" Then
Address = reader.ReadString()
sString2 += "<h2>" & Address & "</h2>"
End If
If reader.Name = "url" Then
Url = reader.ReadString()
sString2 += "<h2>" & Url & "</h2>"
End If
If reader.Name = "gig" Then
Gig = reader.ReadString() & "<br />"
sString2 += "" & Gig & ""
hasEnteredGig = 0
End If
End While
If hasEnteredGig = 0 Then
sString = Left(sString, (sString.Length) - 148)
End If
'sString = sb.ToString()
reader.Close()
Like I say this works fine when debuging the project locally, but
fails online.
Hopefully someone can help :)