Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Treeview-Error: There is invalid data at the root level. Line 1, position 1.

11 views
Skip to first unread message

calderone

unread,
Apr 11, 2002, 11:54:38 AM4/11/02
to
Hi:
i switched from vs.net beta2 to the RTM version yesterday and now i am
facing the following problem: my treeviewcontrol is creating the
following error when i want to browse the asmx page:

There is invalid data at the root level. Line 1, position 1.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: There is invalid data at
the root level. Line 1, position 1.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.

Stack Trace:

[XmlException: There is invalid data at the root level. Line 1,
position 1.]
System.Xml.XmlTextReader.ParseRoot() +295
System.Xml.XmlTextReader.Read() +127
Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(String
TreeNodeSrc, String TreeNodeXsltSrc, String strOuter) +136
Microsoft.Web.UI.WebControls.TreeView.ReadTreeNodeXmlSrc() +80
Microsoft.Web.UI.WebControls.TreeView.OnInit(EventArgs e) +91
System.Web.UI.Control.InitRecursive(Control namingContainer) +234
System.Web.UI.Control.InitRecursive(Control namingContainer) +178
System.Web.UI.Control.InitRecursive(Control namingContainer) +178
System.Web.UI.Page.ProcessRequestMain() +171
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0;
ASP.NET Version:1.0.3705.0


everything functioned perfect in beta but now its not working. i have
installed the correct iewebcontrols available from msdn, and i also
created a new asmx file with fresh controls but whenever the
treecontrol is used the above problem occurs. the treeview is fed with
xml generated from sqlserver directly through http, means through iis
virtual directory management, there is no xml file stored on disk.

any idea on what the error could be and how to resolve it ?

any help appreciated,
tia calderone

Alexander Siniougin

unread,
Apr 11, 2002, 3:37:09 PM4/11/02
to
I get same error and i think it happens when you remove anonymous access for
website. So when you specify TreeNodeSrc attribute it trys to access
specified resource but doesn't get authenticated. It used to work in BETA1
release but doesn't in BETA2 or final Release.

Is it bug?


Alexander Siniougin

unread,
Apr 12, 2002, 12:19:48 AM4/12/02
to
Here is what i found on that:

Worked with anandh on finding out the root cause of this issue.
this is a bug and we don't support having any authentication on the xml
files used in the treeview's TreeNodeSrc property.
workarounds:
1. use a fully qualified file path (eg: d:\inetpub\wwwroot\mydoc.xml)
or (eg: \\machine\sharename\filename.xml)
(do not use http protocol (i.e DO NOT USE:
http:\\servername\appname\filename.xml)


Thanks
Venkat Chilakala

This posting is provided AS IS with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.


calderone

unread,
Apr 12, 2002, 5:49:01 AM4/12/02
to
Hi Alex:
pls reconfirm, is this a bug or not in RTM ???
i was putting treenodesrc = http://localhost/abc?=execute+sproc_name
in vs.net beta2 and it worked well!
i cant work with a static xml file, like
treenodesrc = d:\inetpub\wwwroot\mydoc.xml,
this is unacceptable. if its a bug then it also means that features
like virtual directory management and the sqlxml feature of sqlserver
2000 are useless now.

btw, authentication has always been anonymous in iis, i checked that.
ok, microsoft, where are the first patches to vs.net rtm ? :))

appreciate your feedback asap,
regards, calderone

"Alexander Siniougin" <s...@mediachase.com> wrote in message news:<eqGBZkd4BHA.2748@tkmsftngp07>...

Alexander Siniougin

unread,
Apr 12, 2002, 12:58:37 PM4/12/02
to
Yeah, it is bug in TreeView Control.
It doesn't work only if you disable anonymous access in IIS, otherwise it
should be fine.
Also i found workaround, you can specify "TreeNodeSrc" property and
initialize it with a XML string.

pTreeObject.TreeNodeSrc = GetXmlString();
pTreeObject.DataBind();

Now u can use any method to get this XML String and there shouldn't be any
authentication problems.

"calderone" <cald...@nexgo.de> wrote in message
news:417bd7e3.02041...@posting.google.com...

calderone

unread,
Apr 13, 2002, 8:44:15 PM4/13/02
to
Hi Alex:
thanks for your help.
I tried to build a workaround of this problem by doing the following:

i wrote a small function as a webservice like this so that an xml file
is generated based on a sproc:

<WebMethod()> Public Function GetSQLXML()
Dim xmldoc as new xml.xmlDocument()
xmldoc.Load("http://localhost/ABC?sql=execute+mysproc")
xmldoc.Save("C:\Inetput\wwwroot\webserivce\test.xml")

Then, on the client side i wrote this so that the generated xml file
can be consumed by the treeviewcontrol:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then
Dim ws as Webservice1.Service2
ws = New Webservice1.Service2()
ws.GetSQLXML() 'invoking the service to generate the xml-file
Treeview1.TreeNodeSrc = "C:\Inetput\wwwroot\webserivce\test.xml"
Treeview1.DataBind()
End If
End Sub


The problem is: in vs.net beta2 the above code works wonderful, BUT in
vs.net RTM it doesnt. The problem starts when the following like shall
be processed:

xmldoc.Load("http://localhost/ABC?sql=execute+mysproc")

the following error is thrown :


System.Net.WebException: The remote server returned an error: (401)
Unauthorized.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult
asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri,
ICredentials credentials)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String
role, Type ofObjectToReturn)
at System.Xml.XmlTextReader.CreateScanner()
at System.Xml.XmlTextReader.Init()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at DA_Expertenmarkt.Services.GetSQLXML() in
C:\Inetpub\wwwroot\DA_Expertenmarkt\Services.asmx.vb:line 151

Obviously there seems to be an authentication problem, but WHERE ?
sql profiler doesnt show any transaction when invoking the service
alone, only the above error occurs.

i have also checked the machine.config file in the processmodel
section.

*THIS IS DRIVING ME NUTS*

any idea what the problem could be why the http-url seems to be a
problem ???
any help is appreciated!!!

tia, calderone

"Alexander Siniougin" <s...@mediachase.com> wrote in message news:<udcYMNk4BHA.1920@tkmsftngp05>...

Matthew Harper

unread,
Apr 16, 2002, 9:27:08 AM4/16/02
to
Calderone,

We are experiencing the same problem you are having with the tree
control, and we have been working with Microsoft Support on the issue.
We have not received a valid solution from then, and it has been over
3 weeks.

We are also not using a static xml file. We are using an .aspx to
created the xml and setting the appropriate mime type. We have
anonymous access enabled on the web application as well. It appears
that those 2 responses are canned answers that they have for the
treeview (not paying attention to the fact that most people don't use
static xml files).

Keep me posted if you find anything, and I"ll do the same.

--M

cald...@nexgo.de (calderone) wrote in message news:<417bd7e3.02041...@posting.google.com>...

Matthew Harper

unread,
Apr 16, 2002, 10:27:56 AM4/16/02
to
Calderone,

Just FYI....... this is not a fix, but it is interesting. If I add
IUSR_Machinename to the Administrators group on the web server the
error goes away. Obviously this is not a solution due to the security
issues involved, but further investigation may shed some light
regarding what specific security right is corrected by adding the
anonymous user to the Admin group.

If I discover it, I will post here.

--M


cald...@nexgo.de (calderone) wrote in message news:<417bd7e3.02041...@posting.google.com>...

calderone

unread,
Apr 17, 2002, 5:29:04 AM4/17/02
to
Hi Matthew:

thanks for your feedback. currently i am also investigating the
problem with the treeviewcontrol, but couldnt find a proper reason nor
a fix to it.
anyway, sounds interesting what you did, adding iusr_machinname to the
administrators in iis, will try that.
guess ms will have to quickly develop the first sp1 for vs.net rtm :)

will keep you updated on the development.
Calderone

matthew...@yahoo.com (Matthew Harper) wrote in message news:<58c31510.02041...@posting.google.com>...

0 new messages