Use the HttpWebRequest class and HttpWebResponse class in. Net to obtain web files,
String url = "http://pic.maizuo.com/usr/100002174/0e495857e71e57b9486aecec788d557e.tmp ";
WebRequest wreq = WebRequest. Create (url );
WebResponse wres = wreq. GetResponse ();
Long len = wres. ContentLength;
Byte [] bytes = new byte [len];
Stream ss = wres. GetResponseStream ();
String path = Server. MapPath ("~ /Images /");
If (! Directory. Exists (path ))
{
Directory. CreateDirectory (path );
}
Int idx = url. LastIndexOf (".");
String suffix = url. Substring (idx); // get the suffix of the uploaded Image
If (suffix. Contains ("tmp "))
{
Suffix = ". jpg ";
}
String pictureName = DateTime. Now. Ticks. ToString () + suffix;
FileStream OS = new FileStream (path + pictureName, FileMode. OpenOrCreate, FileAccess. Write );
Int c = 0;
While (c = ss. Read (bytes, 0, bytes. Length)> 0)
{
OS. Write (bytes, 0, c );
}
OS. Close ();
Ss. Close ();