2016-12-17 82 views
1

所以我試着去開發一個網站的一個項目,該事情是我必須做到以下幾點:asp.net從網頁訪問的文件夾

管理員必須訪問的文件夾(我需要把一個按鈕管理頁面如此按下時會打開一個包含子文件夾的特定文件夾)。

該文件夾位於server.mappath中,與app_data位於同一級別,依此類推。

我需要一種方法來訪問它,因爲當我嘗試這樣做:

String foldername = "name"; 

Response.ContentType = "application/octet-stream"; 

Response.AppendHeader("content-disposition", "attachment;filename=" + foldername); 

Response.TransmitFile(Server.MapPath("~/" + foldername)); 

Response.End(); 

我得到一個「訪問該文件夾被拒絕」錯誤:/

請幫助我必須做我的項目工作

+0

在回答部分更新您的答案。 – Rajput

+0

好的,我會做到的 –

回答

1

更新:

只是解決了它自己,看來我是用「.TransmitFile」,這是上載文件!使用:System.Diagnostics.Process.Start(「explorer.exe」,@「把物理路徑放在這裏」);它像魔術一樣工作! :D