huakaiyueluo

导航

抓取网页图片,文件等核心方法

 try
                        {
                            string savepicPath = ServerUtil.MapPath(StringUtil.urldecode(jc.url(string.Format("/downmodel/stuplace_temp/{0}.jpg", Name))));
                            WebRequest request = WebRequest.Create(coverPath);
                            WebResponse response = request.GetResponse();
                            Stream resStream = response.GetResponseStream();
                            StreamWriter sw_1 = new StreamWriter(savepicPath);
                            resStream.CopyTo(sw_1.BaseStream);
                            sw_1.Flush();
                            sw_1.Close();
                        }
                        catch (Exception ex)
                        {
                            continue;
                        }

posted on 2016-01-14 09:44  huakaiyueluo  阅读(265)  评论(0编辑  收藏  举报