string CameraUrl = this.txt_URL.Text; if (string.IsNullOrEmpty(CameraUrl) == false) { byte [] buffer=new byte[300000]; int read, total = 0; //Create a HTTP Request HttpWebRequest req = (HttpWebRequest)WebRequest.Create(CameraUrl); //Request Credential req.Credentials = new NetworkCredential("user", "user"); //Get Response WebResponse resp = req.GetResponse(); //Get Response Stream Stream stream = resp.GetResponseStream(); //Read data from stream while ((read = stream.Read(buffer, total, 1000)) != 0) { total += read; } //Get Bitmap MemoryStream memstream = new MemoryStream(buffer, 0, total); Bitmap img = (Bitmap)Bitmap.FromStream(memstream); // Exception here this.pictureBox1.Image = img; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)