日期:2014-05-17  浏览次数:20529 次

我发现我最近发的帖子,总是没人能答上来,看看这个你能行吗?
有个图片,url是:
http://s7d7.scene7.com/ir/render/AmsterdamRender/41119?obj=color/BAR&color=732B43&show&obj=imprint/BARRL&show&decal&src=fxg{Amsterdam/ASP312?setAttr.NONE={visible=true}&setElement.text=%3Ccontent%3E%3Cp%20fontFamily=%22HelveticaNeueLT%20Std%22%20fontSize=%2212%22%20fontWeight=%22normal%22%20fontStyle=%22normal%22%20color=%22%2523FFFFFF%22%3EOh%2bmy%2bgod%3C/p%3E%3C/content%3E&setAttr.text={breakOpportunity=none}&setAttr.text={s7:maxFontSize=-1}&op_sharpen=1&scale=10&}&size=1.75,0.50&qlt=80,1&resmode=sharp2&sharpen=1&wid=800

请教如何用程序把这张图片下载下来?

注意: 以下这两种方法都不行(如果url是像http://www.baidu.com/baidu.jpg这样的还行.我这种不行.)
C# code

void getImageFromWebsite1(url)
        {
            string filepath = "F:\\pic.jpg";
            WebClient mywebclient = new WebClient();
            mywebclient.DownloadFile(url, filepath);
        }
        void getImageFromWebsite2(url)
        {
            WebRequest request = WebRequest.Create(url);
            WebResponse response = request.GetResponse();
            Stream reader = response.GetResponseStream();
            FileStream writer = new FileStream("F:\\pic.jpg", FileMode.OpenOrCreate, FileAccess.Write);
            byte[] buff = new byte[512];
            int c = 0; 
            while ((c = reader.Read(buff, 0, buff.Length)) > 0)
            {
                writer.Write(buff, 0, c);
            }
            writer.Close();
            writer.Dispose();
            reader.Close();
            reader.Dispose();
            response.Close();
        }





------解决方案--------------------
你这是在卖萌
------解决方案--------------------
果然是在卖萌
------解决方案--------------------
原来真在卖萌
------解决方案--------------------