aspnet对文件,文件夹以及xml的操作

时间:2010-08-26 04:32:32
【文件属性】:
文件名称:aspnet对文件,文件夹以及xml的操作
文件大小:1KB
文件格式:RAR
更新时间:2010-08-26 04:32:32
xml using System.IO;
using System.Xml;
protected void Page_Load(object sender, EventArgs e)
{
string path = Server.MapPath("xiaofeng.txt");
//创建记事本xiaofeng并写入内容
FileStream fso = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter file = new StreamWriter(fso, System.Text.Encoding.GetEncoding("GB2312"));
file.Write("aaaaaaaaaa");
file.Flush();
file.Close();
fso.Close();
string path1 = Server.MapPath("xiaofenga.txt");
StreamReader sr = new StreamReader(path1);
//读取所有内容
Response.Write(sr.ReadToEnd());
//读取第一行内容
Response.Write(sr.ReadLine());
//删除文件
【文件预览】:
aspnet对文件,文件夹以及xml的操作.txt

网友评论

  • 一个RAR压缩文件~解压后是一个.TXT文本文件~内容还是比较详细的~不过如果没有这方面专业的基础知识比较不容易理解~