标签:http ar os sp 文件 数据 on bs html
/// <summary>
/// 创建TXT文本并往里面写入数据
/// </summary>
/// <param name="FileName">要创建的文件名,不要后缀名</param>
protected void WriteTxt(string FileName)
{
Encoding code = Encoding.GetEncoding("gb2312"); //编码格式
string htmlfilename = HttpContext.Current.Server.MapPath("/txt/" + FileName + ".txt"); //文件保存路径
string str = ""; //写入内容
StreamWriter sw = null;
{
try
{
sw = new StreamWriter(htmlfilename, false, code);
sw.Write(str);
sw.Flush();
}
catch { }
}
sw.Close();
sw.Dispose();
}
标签:http ar os sp 文件 数据 on bs html
原文地址:http://www.cnblogs.com/a-mumu/p/4106277.html