/// summary /// 读文件方法 /// /summary /// param name=filename文件名/param /// returns文件内容/returns private string readfile(string filename) { string str = ; string filenamepath = filename; //打开文件 streamreader sr = file.opentex
///
/// 读文件方法
///
/// 文件名
/// 文件内容
private string readfile(string filename)
{
string str = ;
string filenamepath = filename;
//打开文件
streamreader sr = file.opentext(filenamepath);
str = sr.readtoend();
sr.close();
return str;
}
///
/// 写文件方法
///
/// 文件名
/// 文件内容
public void writefile(string path, string strings)
{
streamwriter sw = null;
try
{
sw = new streamwriter(path, false, system.text.encoding.utf8);
sw.write(strings);
sw.flush();
}
catch (exception exp)
{
httpcontext.current.response.write(exp.message);
httpcontext.current.response.end();
}
finally
{
sw.close();
}
}