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

添加人:happyjlaaa一级(220分)   添加时间:2008-07-14    阅读次数:823  收藏此教程
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() + "'";
    }
1页 第1上一页1下一页
相关的教程: word文档另存为
收藏此教程

当前平均分: 4.0(2 次打分)

-5-4-3-2-1012345
评论主题
您的大名
您的评论
验证码 点击换一个验证码
知识库搜索: