请问怎用C#生成静态html文件

解决方案 »

  1.   

    生成字符串,写入到html文件里就可以啦!
    例如:
    string  str="<head>.....</head>";
    using (StreamWriter sw = new StreamWriter("TestFile.txt")) 
            {
                // Add some text to the file.
                sw.Write(str);
             }
      

  2.   

    是的.用
    System.IO
    写文件
      

  3.   

    这样写的话要好一点
    stringWrite  str="<head>.....</head>";
    using (StreamWriter sw = new StreamWriter("TestFile.txt")) 
            {
                // Add some text to the file.
                sw.Write(str);
             }
    因为stringwrite会自动转换成XML的格式的.
      

  4.   

    如何用C#修改已知的txt或者html文件?
      

  5.   

    关注,希望有大侠出来解决一下,怎么把一个html文件替换里面的某些内容,如标题,正文后生成一个新的html,我现在用regex.replace操作,用file.createtex(), 可是会出现编码错误,好像file.createtex()只能用utf-8编码
      

  6.   

    已经解决了,原来streamwrite也可以指定编码