public HttpResponseMessage ReturnBytes(byte[] bytes) { HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.COntent= new ByteArrayContent(bytes); result.Content.Headers.COntentType= new MediaTypeHeaderValue("application/octet-stream"); return result; }
[HttpPost] public string GetCalculatorResults() { byte[] imgArr = GetImageFromDataBase(); // Here we are converting the byte array to Base64String return Convert.ToBase64String(imgArr) }