This is my piece of code (file is a HttpPostedFileBase type):
var imageStream = file.InputStream;
var header = new Byte[4];
imageStream.Read(header, 0, header.Length);
Now, while my code runs, i place a breakpoint, and in my immediate window i check values:
header
{byte[4]}
[0]: 255
[1]: 216
[2]: 255
[3]: 224
But, when i want to convert this byte array to string of ASCII, i get this (values obtained by immediate window):
Encoding.ASCII.GetString(header)
"????"
Encoding.ASCII.GetString(header, 0, 2)
"??"
What am I doing wrong?