我有一個窗體,用戶可以在其中附加word文檔&保存在SQL數據庫中。檢索這些文件完美地通過HTTP工作,但在https上打破。我在會話中存儲文檔。這裏是我的代碼來檢索文件:通過HTTPS(C#)下載文件
Attachments attach = AttachmentsSession[e.Item.ItemIndex] as Attachments;
string extension = attach.Extension;
byte[] bytFile = attach.AttachmentData;
Response.Clear();
Response.Buffer = true;
if (extension == ".doc")
{
Response.ContentType = "application/vnd.ms-word";
Response.AddHeader("content-disposition", "attachment;filename=" + attach.Name);
}
else if (extension == ".docx")
{
Response.ContentType = "application/vnd.openxmlformats-
officedocument.wordprocessingml.document";
Response.AddHeader("content-disposition", "attachment;filename=" + attach.Name);
}
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(bytFile);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.End();
再次,它可以在HTTP,但並非位於https &的文檔存儲在SQL數據庫。請幫助
對於混淆感到抱歉。讓我再解釋一遍。用戶無論是http還是https,都可以上傳文件。但是當管理員進入網絡界面時,他們無法下載用戶通過https上傳的文件。上面的代碼是爲管理員下載文件 – 2011-03-03 19:34:06