protected void Page_Load(object sender, EventArgs e)
{
WebRequest myrequest = WebRequest.Create("http://xxxxx/userface.jpg");
WebResponse myresponse = myrequest.GetResponse();
Stream imgstream = myresponse.GetResponseStream();
System.Drawing.Image img = System.Drawing.Image.FromStream(imgstream);
//img.Save(Server.MapPath("test.jpg"),System.Drawing.Imaging.ImageFormat.Jpeg);
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ClearContent(); //需要输出图象信息 要修改HTTP头
Response.ContentType = "image/gif";
Response.BinaryWrite(ms.ToArray());
}
{
WebRequest myrequest = WebRequest.Create("http://xxxxx/userface.jpg");
WebResponse myresponse = myrequest.GetResponse();
Stream imgstream = myresponse.GetResponseStream();
System.Drawing.Image img = System.Drawing.Image.FromStream(imgstream);
//img.Save(Server.MapPath("test.jpg"),System.Drawing.Imaging.ImageFormat.Jpeg);
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ClearContent(); //需要输出图象信息 要修改HTTP头
Response.ContentType = "image/gif";
Response.BinaryWrite(ms.ToArray());
}