Open Html file - CSharp Operating System

CSharp examples for Operating System:Process

Description

Open Html file

Demo Code


using System.IO;/*from  w w w . j  a  va  2 s.co m*/

public class Main{
    public static void OpenHtml(string html)
    {
      try
      {
        string fileName = Path.GetTempFileName() + ".html";
        File.WriteAllText(fileName, html);
        System.Diagnostics.Process.Start(fileName);
      }
      catch
      {
      }
    }
}

Related Tutorials