在服务器上创建 .txt 文件
1 context = HttpContext.Current; 2 string ServerPath = HttpContext.Current.Server.MapPath("~"); 3 string FilePath = ServerPath + "\\wx\\weixin.txt"; 4 if (File.Exists(FilePath)) 5 { 6 File.Delete(FilePath); 7 } 8 string strCon = Request.Url.ToString(); 9 StreamWriter _StreamWriter = new StreamWriter(FilePath, false, System.Text.Encoding.GetEncoding("GB2312")); 10 _StreamWriter.WriteLine(strCon); 11 _StreamWriter.Flush(); 12 _StreamWriter.Close();