How to programmatically write *.html file and open it in IE????

Hi,
I want to programmatically write html tags and save the content into an html (example:test.html). Then, I like to open it in IE window to see the content. Can you please help me with that I also added my code that doesn't save the content (html tags) into the file.

string reportFilename = "report.html";

if (File.Exists(reportFilename))

File.Delete(reportFilename);

string reportContent = null;

reportContent ="<Html><Head><Title>Report For Testing</Title></Head>";

reportContent +="<Body><H4><B>Help Work Flow Tool Report</B></H4></Body></Html>";

StreamWriter sw = File.CreateText(reportFilename);

sw.Write(reportContent);

System.Diagnostics.Process.Start(reportFilename);

Thanks,
vcboy


Answer this question

How to programmatically write *.html file and open it in IE????

  • levin

    Hello,
    I found what is causing the code worked improperly. I forgot to close StreamWriter by sw.close();. Okay, thanks for your time and consideration.
    vcboy

  • How to programmatically write *.html file and open it in IE????