回复: 怎么这样??????
#region 下载文件按钮事件
protected void btn_DownLoad_Click(object sender, EventArgs e)
{
//从web.config读取文件上传路径
string strFileUploadPath = ConfigurationManager.AppSettings["FileUplodePath"].ToLower();
//从列表框中读取选择的文件
string strFileName = lb_FileList.SelectedValue;
//组合成物理路径
string FullFileName = Server.MapPath(strFileUploadPath + "/") + strFileName;
FileInfo fi = new FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(FullFileName), System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", fi.Length.ToString());
Response.WriteFile(FullFileName);
Response.Flush();
Response.End();
}
#endregion