-1

i am getting stream from httpwebresponse which is send by the another web server, here i want to convert this web stream to Bitmap and then this converted image is used to show as response in c#.

HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(url);
using (HttpWebResponse myResp = (HttpWebResponse)myWebRequest.GetResponse())
                    { 
                        if (myResp.ContentType.Contains("image/jpeg"))
                        {
                            Stream myStream = myResp.GetResponseStream();
  • what is the format of your data in the stream ? – Felix D. Jan 16 '18 at 12:49
  • Maybe [Stream to byte\[\]](https://stackoverflow.com/questions/221925/creating-a-byte-array-from-a-stream) => [byte\[\] to Base64](https://msdn.microsoft.com/de-de/library/dhx0d524(v=vs.110).aspx) => [Base64 to Bitmap](https://stackoverflow.com/questions/5083336/decoding-base64-image) – Felix D. Jan 16 '18 at 12:53

1 Answers1

2
System.Drawing.Image.FromStream(myResp.GetResponseStream());

You can convert stream to image like that