none
如何用WebRequest进行多个文件的下载? RRS feed

  • 问题

  • 我用WebRequest类和WebResponse类实现了服务器上指定文件f1.jpg的下载,代码如下:

        string saveInfo = appPath + picturePath + "f1.jpg";
    
        string urlInfo = "http://www.myserver.com/Image/"+ @"\" + "f1.jpg";//下载文件链接地址
    
        WebClient wcClient = new WebClient();
    
        WebRequest webReq = WebRequest.Create(urlInfo);
    
        WebResponse webRes = webReq.GetResponse();
    
    

    现在我想通过只发送一次webrequest请求,就将多个文件f1.jpg、f2.jpg、f3.jpg一次性下载下来。可以吗?具体应该怎么写代码?


    2011年5月28日 9:52

答案

  • 比如客户端传zip,服务器端解压

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    • 已标记为答案 Paul Zhou 2011年6月6日 5:46
    2011年5月30日 18:18
    版主

全部回复

  • HTTP协议不支持这么做.联系服务器的开发人员看看有没有别的通讯协议.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2011年5月29日 3:38
    版主
  • HTTP协议不支持这么做.联系服务器的开发人员看看有没有别的通讯协议.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    我改用了WebClient类,用FTP协议下载,好像也不行。
    请给我建议可以的协议,谢谢!
    2011年5月30日 0:38
  • 比如客户端传zip,服务器端解压

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    • 已标记为答案 Paul Zhou 2011年6月6日 5:46
    2011年5月30日 18:18
    版主