Search code examples
c#browserhtmltextwriter

C# and writing HTML - best way?


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


Solution

  • Depending on your application requirements you could host your own browser control and build the content:

    System.Windows.Forms.WebBrowser _browser = new WebBrowser();
    _browser.DocumentText = "<html><head><title>My Web Page</title></head><body>Hello World!</body></html>