The first couple of characters indicate that the response is probably an jpeg file interpreted as ASCII text. I guess the Content-Type
header in the HTTP response has the wrong value, probably something like text/plain
or text/html
instead of image\jpeg
. This makes Chrome display the image as plain text.
I don't think you have to convert the data. Just save the response stream to a file and you will have a proper jpeg file:
string url = "http://my-domain/getimage.asp?pic=4c54aae0ea...";
string fileLocation = @"C:\MyImage.jpg";
var client = new WebClient();
client.DownloadFile(url, fileLocation);
The reason I think that the response is probably jpeg, is that a jpeg file begins with 0xFFD8FFE0
which looks like ÿØÿà
when displayed as ISO 8859-1
encoded text.