title: Get Image From Api And Display In Razor View
body: <p>I have webApi method from which I have fetch the employee record and their hex encrypt image using Oracle database in a byte array, when I get the byte array in my application and call it in razor view using img src tag it is not displaying the image. 
  Here is what I am trying so far:</p>
  
  <pre><code>while (rdr.Read())
  {
      EmployeeRefVM emp = new EmployeeRefVM();
      emp.REF_NO = rdr["REF_NO"].ToString();
      emp.ENAME = rdr["ENAME"].ToString();
      emp.EMP_PIC = (byte[])rdr["EMP_PIC"];//get Image in byte[]
      emp.age = GetAge(emp.EMP_DOB);
      employeelist.Add(emp);
  }
  </code></pre>
  
  <p>and in my .net core application I call it</p>
  
  <pre><code>TempData["EmpPic"] = employeeDetails.EMP_PIC;
  public ActionResult Image()
  {
      var allsystemconfig = _systemConfigServices.getAllSystemconfig();
      var wwwrootpath = _environment.WebRootPath;
      string filePAth = wwwrootpath + allsystemconfig.FirstOrDefault(q =&gt; q.MetaKey == "DefaultImage").MetaValue;
      byte[] imageData = (byte[])TempData["EmpPic"];
      string base64String = Convert.ToBase64String(imageData);
      return base.File(imageData, "image/png");
  }
  </code></pre>
  
  <p>And here is my View</p>
  
  <pre><code>@{
      var base64 = Convert.ToBase64String(Model.EMP_PIC);
      var imgSrc = String.Format("data:image/jpeg;base64,{0}", base64);
      img src='@Url.Action("Image", "Party")' 
  }
  </code></pre>
  
  <p>Image Save In Database:</p>
  
  <p><img src="https://i.stack.imgur.com/IkZbx.png" alt=""></p>
  
  <p>Image Receive From DB:</p>
  
  <p><img src="https://i.stack.imgur.com/l95OK.png" alt=""></p>