+ -
当前位置:首页 → 问答吧 → 从服务端下载文件后刷新页面问题

从服务端下载文件后刷新页面问题

时间:2011-12-07

来源:互联网

从服务端DownLoad文件后怎么能刷新客户端的页面啊?最好能自动刷新.
protected void Button1_Click(object sender, EventArgs e)
    {
        string filePath = Server.MapPath("模板.xls");//要下载的路径
        DownLoad(filePath);
        Label1.Text = "11111111111";
    }
    public void DownLoad(string filePath)
    {
        FileInfo info = new FileInfo(filePath);
        string FileName = "moban.xls";//客户端保存的文件名
        if (info.Exists == true)
        {
            Response.Clear();
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachem;filename=" + HttpUtility.UrlEncode(FileName));
            Response.AddHeader("Content-Length", info.Length.ToString());
            Response.WriteFile(info.FullName);           
            Response.Flush();
            Response.End();//这个好像是停止了与客户端的交互(在网上查的)......该怎么修改啊
        }
    }

作者: 耿圈   发布时间: 2011-12-07

高手呢???

作者: 耿圈   发布时间: 2011-12-07