I need to display an image using the download url . I am using the below logic to convert it into a base 64 string.
HttpWebRequest fileReq = (HttpWebRequest)HttpWebRequest.Create(downloadUrl);
HttpWebResponse fileResp = (HttpWebResponse)(fileReq.GetResponse());
fileResp.GetResponseStream().CopyTo(ms);
byte[] byteArray = ms.ToArray();
if (byteArray != null)
{
return Convert.ToBase64String(byteArray);
}
Trying to use this to display the image. I get the Base 64 string correctly in "response.data"
<img src="data:image/tiff;charset=utf-8;base64,' + response.data + '" />
Still I am seeing only a broken image. Anything that I am missing ?