2013-08-16 44 views
1

我已經添加pdf下載到我的應用程序。當我點擊下載時,瀏覽器正在詢問是否保存或打開PDF文檔。但我需要將其設置爲默認,以便下次不會提示。如何禁用從瀏覽器中彈出的下載從c#.Net

這裏是我的代碼:

Response.ContentType = "application/pdf"; 
Response.AppendHeader("Content-Disposition","attachment; filename=" + "Report.pdf"); 
Response.TransmitFile(pdfFileName); 
+0

該代碼將工作,除非你在瀏覽器中的安全設置它要求用戶確認。 –

回答

0

希望它能幫助你。 的附加文件轉換成緩衝區首先..

 Byte[] buffer = client.DownloadData(path); 

     if (buffer != null) 
     { 
      Response.ContentType = "application/pdf"; 
      Response.AddHeader("content-length", buffer.Length.ToString()); 
      Response.BinaryWrite(buffer); 
     } 
+0

現在工作正常。我需要將Adobe Reader的默認縮放大小設置爲100%。可能嗎? –

1

你無法控制,它在你的客戶的瀏覽器處理這個範圍。

相關問題