M
MB
Hi, I am using a web service to call an asp page on a remote server via
System.Net.WebClient . The asp page returns a xml stream persisted from a
recordset.
I am having problems converting the stream into a valid xmltextreader
document. I have also converted the document to the simple format without
the DTD ( just plain xml file )
and I still get the same error:
Illegal characters in path.
Exception Details: System.ArgumentException: Illegal characters in path.
I have pasted to code below:
<WebMethod(Description:="passsing ODBC sql str and DSN paramenters. Returns
datatable")> _
Public Function TestURL(ByVal strSQL As String, ByVal DSN As String) As
datatable
Dim web As New System.Net.WebClient
Dim URL As String = "http://remote_server/query_legacy.asp"
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim param1 As String = "strSQL=" & strSQL
Dim param2 As String = "DSN=" & DSN
Dim params As String = param1 & "&" & param2
Dim bytparams As Byte() = BuildPostData(params)
Dim res As Byte() = web.UploadData(URL, "POST", bytparams)
Dim ds As New DataSet
Dim str1 As String = System.Text.Encoding.ASCII.GetString(res)
==> ERROR RIGHT HERE: Dim stream_r As New StreamReader(str1)
Dim xml_r As New System.Xml.XmlTextReader(stream_r)
ds.ReadXml(xml_r)
Return ds.Tables(1)
End Function
System.Net.WebClient . The asp page returns a xml stream persisted from a
recordset.
I am having problems converting the stream into a valid xmltextreader
document. I have also converted the document to the simple format without
the DTD ( just plain xml file )
and I still get the same error:
Illegal characters in path.
Exception Details: System.ArgumentException: Illegal characters in path.
I have pasted to code below:
<WebMethod(Description:="passsing ODBC sql str and DSN paramenters. Returns
datatable")> _
Public Function TestURL(ByVal strSQL As String, ByVal DSN As String) As
datatable
Dim web As New System.Net.WebClient
Dim URL As String = "http://remote_server/query_legacy.asp"
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim param1 As String = "strSQL=" & strSQL
Dim param2 As String = "DSN=" & DSN
Dim params As String = param1 & "&" & param2
Dim bytparams As Byte() = BuildPostData(params)
Dim res As Byte() = web.UploadData(URL, "POST", bytparams)
Dim ds As New DataSet
Dim str1 As String = System.Text.Encoding.ASCII.GetString(res)
==> ERROR RIGHT HERE: Dim stream_r As New StreamReader(str1)
Dim xml_r As New System.Xml.XmlTextReader(stream_r)
ds.ReadXml(xml_r)
Return ds.Tables(1)
End Function