现在要做winform小程序,有一个功能是这样的:
我要给一个网页传递参数,然后这个网页就给我返回一个文件,让我下载。
比如:我发送:http://www.index.aspx?Action=Get&UserPermit=123
然后就返回一个abc.zip的文件。
我想问一下:这个我要怎么发送,然后又如何接收啊?
对这个不是很了解,希望大家给予帮忙。

解决方案 »

  1.   

    private void button1_Click(object sender, EventArgs e)
    {  Download("http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe");
    }private void Download(string Name)
    {
      this.progressBar1.Minimum = 0;
      this.progressBar1.Maximum = 100;
      WebClient wc = new WebClient();
      Uri Url = new Uri(Name);
      wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
      wc.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_DownloadFileCompleted);
      wc.DownloadFileAsync(Url, "k:\\dotNetFx40_Full_x86_x64.exe");
    }
    private void wc_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
    {
      this.progressBar1.Value = (int)Math.Floor((Double)e.BytesReceived * 100 / e.TotalBytesToReceive);
    }private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
    {
      this.progressBar1.Value = 100;
    }
      

  2.   

    这样是可以下载,但是我不知道我要下载的文件的地址,我只能通过发送http://www.index.aspx?Action=Get&UserPermit=123,然后它返回文件的下载地址。那我怎么样得到它返回的地址呢?
      

  3.   

    http://topic.csdn.net/t/20011128/10/392096.html#r_2613947
    这个贴中有这样的功能,发链接返回字符串,不过是C++的
      

  4.   

    思路很好,如果你的 *.zip 文件是物理模式存放,可以采用Ftp协议来下载或上传。