I have an XML web control on a usercontrol. The only purpose for this
usercontrol is to get XML data from a URL and display
it in the xml web control with the help of XSL.
I can get this to work if I log into the machine that is hosting the
website, whether it be my dev box or staging box. When I try to access the
page remotely, I get an error:
This is an unexpected token. The expected token is 'QUOTE'. Line 1, position
110.
at System.Xml.XmlScanner.ScanToken(Int32 expected) at
System.Xml.XmlTextReader.SetLiteralValues(XmlAttri buteTokenInfo fld) at
System.Xml.XmlTextReader.SetAttributeValues() at
System.Xml.XmlTextReader.ParseElement() at System.Xml.XmlTextReader.Read() at
System.Xml.XmlLoader.LoadChildren(XmlNode parent) at
System.Xml.XmlLoader.LoadElementNode() at
System.Xml.XmlLoader.LoadCurrentNode() at
System.Xml.XmlLoader.LoadChildren(XmlNode parent) at
System.Xml.XmlLoader.LoadElementNode() at
System.Xml.XmlLoader.LoadCurrentNode() at
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at
Website.mysurveys1.GetXML(String strSourceFile)
Here are the following entries in my web.config file:
<authentication mode="Windows" />
<identity impersonate="true" />
And here is the code I wrote in the usercontrol to access the XML:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Xml1.Document = GetXML("http://somedomain/folder/GetXml.asp")
End Sub
Function GetXML(ByVal strSourceFile As String)
Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(strSourceFile)
myRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
Try
Dim myResponse As System.Net.WebResponse =
myRequest.GetResponse()
Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())
Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument
doc.Load(myReader)
GetXML = doc
Catch ex As Exception
Response.Write(ex.Message.ToString & "
" & ex.StackTrace.ToString)
End Try
End Function
The error is occuring at this line of my function:
Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()
Am I doing something wrong?
I have been searching for an answer for a few days now to no avail. Any
help would be greatly appreciated.