http://patent2.kipris.or.kr/pateng/excela.do?method=excelDown&expression=*TL=[battery]上面的url在浏览器中打开会弹出保存对话框,但是用webclient下载保存的文件确实空的只要能正确下载就给分

解决方案 »

  1.   

    加上
    WebClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
      

  2.   

    你的其他代码是什么?
    我这里已经可以用webclient下载下来了
      

  3.   

    WebClient web = new WebClient();
    web.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");web.DownloadFile("http://patent2.kipris.or.kr/pateng/excela.do?method=excelDown&expression=*TL=[battery]", "xx.xls");
      

  4.   

    Google Chrome 下载完全正常
      

  5.   

    WebClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
    WebClient.Headers.Add("refer:url");顺便加一个引用页地址,加上
      

  6.   


    如此还是不行,不过能得到字节流已经可以了,将字节流转换成excel保存也ok的
    结贴了