c# load embedded html document and show in browser code example

Example: c# load embedded html document and show in browser

1. Add HTML Page from C3 Add New Item
2. Put html inside
3. Drag and drop the html (e.g. HTMLPage1.html) file into your Resources tab in the project:
4. Use code below 
        private void button1_Click_1(object sender, EventArgs e)
        {
            string html = Properties.Resources.HTMLPage1;
            string tmpFileName = Path.ChangeExtension(Path.GetTempFileName(), ".html");
            using (StreamWriter sw = File.CreateText(tmpFileName))
            {             
                sw.Write(html);
                sw.Flush();
            }
            if (File.Exists(tmpFileName))
                Process.Start(tmpFileName);
        }

Tags:

Html Example