I have base64 string of an image. converting it to byte array & then converting it to memoryStream. How can i download this image to client machine. The base64 string or image is not saved on server/folder/anywhere. It is create dynamically. I have tried
1) Response.ContentType = "image/png" => gives exception obj not set to instant of an object. like this
Context.Response.Clear();
Context.Response.ClearHeaders();
Context.Response.AddHeader("Content-Disposition", "attachment; filename=" + registrationId + ".png");
Context.Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Length", bytes.Length.ToString());
//Response.ContentType = "application/octet-stream";
Context.Response.BinaryWrite(bytes);
2) using web client => gives exception
using (WebClient client = new WebClient())
{
client.DownloadFile(ms1.ToString(), registrationId + ".png");
}
Any other solution?