Open HTML in browser

I have a C # application that calls an API, and the response is in HTML format . i don't want to save the HTML code to a file, but I want to open this html code in a browser

I can show if HTML is saved in a file using

System.Diagnostics.Process.Start(pathToHtmlFile);
+4
source share
2 answers

If you want to display your HTML code in an external browser, you must temporarily save your code in a file and execute the browser using Process.Start.

html- WebBrowser-Control. DocumentCompleted  , , WebBrowser.Document .

+3

WebBrowser Windows:

WebBrowser browser = new WebBrowser();

// Navigate to URL
browser.Navigate("http://www.somesite.com");

// Set HTML code
browser.Document.Write("<html><body>...</body></html>");

// Another way to set HTML code
browser.DocumentText = "<html><body>...</body></html>";

, , -

+2

Source: https://habr.com/ru/post/1532257/


All Articles