I would need to build a HTML document from plain text and display it in webBrowser. I was thinking of better way - I can see there is HTMLTextWriter in System.Web.UI but I cannot reference this namespace, could anyone advice? Thanks
C# and writing HTML - best way?
877 views Asked by Petr At
2
There are 2 answers
2
On
Simplest way is to use plain XmlWriter
(or, if you need more complex building than just writing a stream of elements, XmlDocument
or XDocument
) and output XHTML.
If you want to use System.Web.UI
classes, you need to reference System.Web.dll
from your project. I wouldn't recommend it, though, as it won't buy you much, and it is not included in the .NET Client Profile (which you might want to use in the future, especially with .NET 4).
Depending on your application requirements you could host your own browser control and build the content: