0

I have built some software that will display an xml string that is retrieved from a database under certain conditions. This works fine on my machine but when it is installed on the users machine the web browser objects display nothing. I have no idea why this is happening as its working on my computer and all the other computers in the office, just not on this server where it needs to.

An example of the code I am using:

webDownloadedInstructDup.DocumentText = DuplicateXml;

Where DuplicateXML would be something like:

<?xml version="1.0" encoding="utf-8"?><shp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><instructions><instruction><id>12345678</id><Reference>123456</Reference><agent><tradeName>Example</tradeName><legalName>Example</legalName></instruction></instructions>

The actual code will be getting the xml from a database and then casting it to a string.

Although I don't think that its the code in this case as it works on all the machines I have tested it on except the server. I am thinking that maybe there is something that needs to be set on this server to allow the use of these web browsers.

Example

The left is how it works normally and the right web browser is how it is on the server. Anyone got a suggestion?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Sam Lucas
  • 233
  • 1
  • 4
  • 16
  • 1
    Personally, I ditched the idea of setting "DocumentText" years ago. Instead, in all my applications where I use a WebBrowserControl, I also use a simple C#-based local in-process web server which servers all my content. In my experience, strange things happen, when you tell the WebBrowserControl to show content that does _not_ come from HTTP. – Uwe Keim Mar 18 '16 at 10:16
  • 1
    Yeah you are right, they were acting weird. I have used a quick fix at the moment by using a rich text box and running it through an XML formatter, this isn't as user friendly but it will do the job until I can come up with a solution. – Sam Lucas Mar 18 '16 at 11:29

1 Answers1

1

Used a quick fix for this as there seems to be some kind of weird functionality with the Web Browser control.

The way I got around it was to use Rich Text Boxes instead, the text for that box was then set to the xml file which had gone through an xml formatter found here:

XML Formatter by Charles Prakash Dasari.

This isnt an ideal solution as I wanted to make it as readable as possible, as you can see from the example image above the Web Browser control does that quite well. This does however make it readable for the user, and allow them to pick out the information they need, so I'm going with this for now as a fix.

Community
  • 1
  • 1
Sam Lucas
  • 233
  • 1
  • 4
  • 16