将服务器上的一个.doc文档另存为到客户端

protected void applyLetter_Click(object sender, EventArgs e)
    {
        string strFileName = Server.MapPath("../InvitationLetterApplicationFormForVisa.doc");
        FileInfo DownloadFile = new FileInfo(strFileName);
        Response.Clear();
        Response.ClearHeaders();
        Response.Buffer = false;
        Response.ContentType = "application/octet-stream";
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
        Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
        Response.WriteFile(DownloadFile.FullName);
        Response.Flush();
        Response.End();
        string strWhere = "UserName='" + Session["UserNameEN"].ToString() + "'";
    }
原文地址:https://www.cnblogs.com/MaxWoods/p/1326136.html