[英]save an pdf file in local folder or downloads
我正在使用以下代碼將 pdf 文件保存在特定文件夾中。 如果文件夾不存在,它將自動創建一個文件夾。 它在本地運行良好。 但是當我將網站發布到 IIS 時。 它不起作用。
string folderPath = "D:\\Labels\\";
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
string file = @"D:\Labels\" + DateTime.Today.ToString("dd-MM-yyhh-mm-ss") + ".pdf" + "";
var fileStream = File.Create(file);
// change file name for PNG images
responseStream.CopyTo(fileStream);
responseStream.Close();
fileStream.Close();
ShowMessage("Downloaded Sucessfully", MessageType.Success);
Ι want to save the file in the local who ever use the website
這是不可能的——你可以提供一個下載文件的鏈接——你不能運行File.
來自服務器的客戶端功能。
File.
函數只能在服務器端工作,並且只有當您對目錄具有權限時。
如何在 IIS 上為 ASP.NET 設置正確的文件權限
通過calling.ashx頁面下載文件
從服務器下載文件的最佳方法是什么
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.