Wednesday, October 1, 2014

  • Read HTML File C# ASP Stream Reader



    string file = Server.MapPath ("abc.html");
    StreamReader sr;
    FileInfo fi = new FileInfo(file);
    if(File.Exists(file))
    {
         sr = File.OpenText(file);
         input += sr.ReadToEnd();
         sr.Close();
    }
     
     
     
     
     

    Another Method 

     

    string[] lines = File.ReadAllLines("path/to/my/file.html");
    foreach(string line in lines)
    {
        Response.Write(line);
    }

     

     
     
     
     
     
  • 0 comments:

    Post a Comment

    Copyright @ 2013 Code Snippets.