天天看点

简单C#生成静态及相关读取模板文件

简单C#生成静态及相关读取模板文件
简单C#生成静态及相关读取模板文件

代码

        string gh = HttpRuntime.AppDomainAppPath;

        StreamReader reader = new StreamReader(gh+"/33.htm", Encoding.GetEncoding("gb2312"));

        string html = reader.ReadToEnd();

        html = html.Replace("<!--123-->", "好好");

        Response.Write(html);

        StreamWriter sw = new StreamWriter(Server.MapPath("311.htm"), false, System.Text.Encoding.GetEncoding("GB2312"));

        sw.WriteLine(html);

        sw.Flush();

        sw.Close();