0
我一直在處理過去2天的問題。我試圖以各種方式進行調試,但徒勞無功。 一切工作正常我的local.But生產失敗。 以下是有關該問題的簡要說明。 我有一個下載按鈕,當我點擊那個按鈕時,我打算從服務器下載一個文件。問題與Response.TransmitFile
保護無效Download_Click(對象發件人,EventArgs的) {
Button downloadButton = sender as Button;
string filePath = downloadButton.CommandArgument;
string stuid = Session["browse_files_for_student"].ToString();
string stuUsername = MyHelper.GetUsernameForStudentID(stuid);
MyHelper.LogAccess(User.Identity.Name, StudentUsername.Text, filePath, MyHelper.LogAccessType.Read);
FileInfo file = new FileInfo(filePath);
// Download the file
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" + file.Name);
try
{
Response.TransmitFile(filePath);
}
catch (IOException error)
{
Response.Cookies.Add(new HttpCookie("global_last_error", "The file is in use by another process."));
Response.Redirect("~/Public/KnownError.aspx");
}
Response.End();
}
我在事件查看器看到,它產生: 的TransmitFile失敗:文件名:dsdfsfd.doc,模擬啓用:0,令牌有效:1 HRESULT:0x8007052e。
環境:網站部署在Windows 2000服務器上。
任何幫助和意見,將不勝感激。 謝謝。