简单的写是这个样子的System.IO.StreamWriter stmPage = null;Directory.CreateDirectory("yourfolderpath");m_sPage = "youfilename";
if (!File.Exists(m_sPage))
{
try
{
stmPage = new StreamWriter(m_sPage,true);
if (stmPage != null)
{
stmPage.WriteLine("yourfilecontents");
stmPage.Close();
stmPage = null;
}
}
catch(System.Exception e)
{
}
}