获取服务器文件路径(并向TXT写入数据代码)

       string s=Server.MapPath("..\\..\\api\\text.txt");  //由相对路径获取物理路径
           FileStream fs = new FileStream(s, FileMode.Create);
           byte[] data = new UTF8Encoding().GetBytes("notify_url");
           fs.Write(data, 0, data.Length);
           fs.Flush();
           fs.Close();

 

posted @ 2014-03-07 14:49  乡土的味道  阅读(326)  评论(0编辑  收藏  举报