C#打开指定文件夹及下载文件代码示例

C#打开指定文件夹:

  System.Diagnostics.Process.Start("explorer.exe", Server.MapPath("EXCEL//")); 

C#下载文件:

     private void down_load_file(string fileName, string filePath)
        {

            FileStream fs = new FileStream(filePath, FileMode.Open);
            byte[] bytes = new byte[(int)fs.Length];
            fs.Read(bytes, 0, bytes.Length);
            fs.Close();
            Response.ContentType = "application/octet-stream";
            //通知浏览器下载文件而不是打开  
            Response.AddHeader("Content-Disposition", "attachment;   filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
            Response.BinaryWrite(bytes);
            Response.Flush();
            Response.End();
        }
原文地址:https://www.cnblogs.com/wangzhenghua/p/3066996.html