user1716958
user1716958

Reputation: 11

When i run my web application. I got Invalid URI: The Uri string is too long

XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(responsedata);

It's give exception: System.UriFormatException: Invalid URI: The Uri string is too long.

Upvotes: 0

Views: 4695

Answers (3)

John VandenBrook
John VandenBrook

Reputation: 103

I believe there is an assumption that responsedata holds a value pointing to an xml file to read in, i.e. "c:\temp\sometest.xml".

From your case, however, it appears that the responedata is a stream you received from a Web Service request. If this is the case, the try the following:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(responsedata);

HTH

Upvotes: 3

Hanno
Hanno

Reputation: 1027

Update your code to use the newer XDocument class, and call XDocument.Parse.

Upvotes: 1

erichste
erichste

Reputation: 759

xmlDoc.Load expects a URL not the file itsself. That's why it is telling that. It expects a normal URI but you hand it a big file...

http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.load.aspx

Upvotes: 4

Related Questions