(我连局域网服务器)我在c#程序里写了数据库备份代码?备份成功了,但是文件在服务器上而没在本地上,.bar文件字服务器上, 怎样才能备份的时候让他备份到本地计算机上呢?

解决方案 »

  1.   

    可以考虑用流的方式提供下载    /// <summary>
        /// 以流的方式提供下载
        /// </summary>
        /// <param name="path">文件路径</param>
        protected void DownLoad(string path)
        {
            FileInfo file = new FileInfo(path);
            Response.Clear();
            Response.ClearHeaders();
            Response.Buffer = false;
            Response.ContentType = "application/octet-stream";
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(file.FullName, System.Text.Encoding.UTF8));
            Response.AppendHeader("Content-Length", file.Length.ToString());
            Response.WriteFile(file.FullName);
            Response.Flush();
            Response.End();
        }
      

  2.   

    文件太大时不宜! 
    备份路径可以设为共享如 \\202.101.100.99\data\bk20070822.bak
      

  3.   

    文件太大时不宜! 
    备份路径可以设为共享如 \\202.101.100.99\data\bk20070822.bak
    ------------------------------------------------------------可以吗?貌似不可以吧 备份时好像只能选择本地磁盘 网络映射的8行哦