string src = temppartsrc + "." + Pictype;
HttpWebRequest request = (HttpWebRequest) webrequest.create (SRC);
Request. AllowAutoRedirect = true;
WebProxy proxy = new WebProxy ();
Proxy. BypassProxyOnLocal = true;
Proxy. useDefaultCredentials = true;
Request. Proxy = proxy;
WebResponse response = Request. GetResponse ();
String virthpath = "";
using (Stream stream = response. GetResponseStream ())
{
using (MemoryStream ms = new MemoryStream ())
{
byte[] buffer = new byte[1024];
int current = 0;
while (current = stream. Read (buffer, 0, buffer. Length))! = 0)
{
Ms. Write (buffer, 0, current);
}
Byte[] Arry = Ms. ToArray ();
Virthpath = "./image/" + DateTime.Now.ToString ("YYYYMMDDHHMMSS") + "." + Pictype;
String path = Server.MapPath (Virthpath);
File.writeallbytes (path, arry);
}
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Download pictures to the specified folder via SRC