1、文件夹
string path = System.Web.Hosting.HostingEnvironment.MapPath("~"); -- 将虚拟路径映射到服务器上的物理路径。
if (Directory.Exists(path + "/ExportExcel") == false) --判断 映射路径下 指定的文件夹是否存在 ,==false 不存在
{
Directory.CreateDirectory(path + "/ExportExcel"); --不存在 则创建
}
2、文件
FileStream file = File.Create(path + "/ExportExcel/" + “文件名字”); ---向 映射路径-文件夹 下创建文件