asp 中创建日志打印文件夹

string FilePath = HttpRuntime.BinDirectory.ToString();

                    string FileName = FilePath + "日志" + "\\" + System.DateTime.Now.ToString("yyyyMMdd") + ".txt";

                    //判断有无当天txt文档,没有则创建

                    if (!File.Exists(FileName))

                    {

                        //创建日志文件夹

                        Directory.CreateDirectory(FilePath + "日志");

                        StreamWriter sw = File.CreateText(FileName);

                        sw.Write(command.ExecuteScalar().ToString());

                        sw.Close();

                    }

 

你可能感兴趣的:(asp)