1-我想向客戶端發送一個帶有密碼的 .zip 檔案夾
和
2-將密碼發送到用戶頁面的底部。
和
3-向用戶發送警告以提高安全意識
在我的 HttpResponse 中,我可以發送檔案或發送彈出訊息和密碼。
提前致謝。
// Creating zip file with password encryption.
string password = Membership.GeneratePassword(64, 10);
FastZip zip = new FastZip();
zip.EntryEncryptionMethod = ZipEncryptionMethod.AES256;
zip.Password = password;
zip.CreateZip(folderPath ".zip", folderPath, true, "");
// Sending file to user.
Response.ContentType = "Application/zip";
Response.AppendHeader("Content-Disposition", "attachment; filename=" folderName);
Response.TransmitFile(Server.MapPath("~/App_Data/Temp/" folderName));
// Sending password and warning to user (popup).
Response.Write("<script>alert('Avertissement : S’il vous pla?t, éviter de conserver les documents confidentiels sur votre poste afin d’éviter la compromission d’informations identifiables personnels (PII) d\\'employés.');</script>");
// Send password to user page (on html page).
litMsgWm.Text = "Utiliser le mot de passe: " password " <br> et le logiciel '7Zip' pour décrypter le fichier zip envoyé à votre navigateur.";
我要發送的內容:
1-密碼
2-安全意識警告
3-壓縮檔案
我試過了:
通過相同的 http 回應發送檔案和密碼。我不知道我們是否可以一個接一個地發送 2 個 Http 回應,或者一次只發送一個?理想情況下,我想向客戶端發送兩個單獨的 Http 回應。我試過了,但它不起作用。(我不是 Http 最好的)
uj5u.com熱心網友回復:
最后,我使用了在客戶端瀏覽器上首先呼叫的 OnClientClick() 來顯示訊息。然后我使用 OnClick() 在服務器上啟動檔案下載。
aspx代碼圖片
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/527320.html