簡體   English   中英

asp.net中的“另存為”對話框

[英]Save As Dialog box in asp.net

我有Web應用程序(asp.net)。當用戶單擊下載按鈕時,有沒有辦法顯示``另存為對話框''(在瀏覽器中)。我嘗試了幾種代碼,但未得到預期的結果。所有通常可以下載文件進行下載(瀏覽器的默認下載路徑)。是否可以在Web瀏覽器中打開另存為對話框

可能您正在尋找在asp.net中下載文件? 請參閱下面的示例。

Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=MyFile.pdf");
Response.TransmitFile(Server.MapPath("~/Files/MyFile.pdf"));
Response.End();
 .htm, .html Response.ContentType = "text/HTML"; .txt Response.ContentType = "text/plain"; .doc, .rtf, .docx Response.ContentType = "Application/msword"; .xls, .xlsx Response.ContentType = "Application/x-msexcel"; .jpg, .jpeg Response.ContentType = "image/jpeg"; .gif Response.ContentType = "image/GIF"; .pdf Response.ContentType = "application/pdf"; 

如何在ASP.Net中下載文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM