title: Show byte stream image asp.net mvc
body: <pre><code>public static string GetAvatar()
  {
      logger.Info("Start--GetAvatar");//aatif
     // string headerText = "Bearer " + token;
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://api.mxit.com/user/public/avatar/id");
      //request.Method = method;
      //request.Headers.Add(HttpRequestHeader.Authorization, headerText);
      //if (contentType != null)
      //{
      //    request.ContentType = contentType;
      //}
  
      string method = "GET";
      if (method == "GET")
      {
          try
          {
              WebResponse response = request.GetResponse(); // Byte Stream
              Stream dataStream = response.GetResponseStream();
              StreamReader reader = new StreamReader(dataStream);
              string responseFromServer = reader.ReadToEnd();
              string JsonGET = responseFromServer.ToString();
  
             // Avatar res = JsonConvert.DeserializeObject&lt;Avatar&gt;(JsonGET);
              reader.Close();
              dataStream.Close();
              response.Close();
              logger.Info("End--GetAvatar");//aatif
              return JsonGET;
          }
  
          catch (Exception ex)
          {
  
              logger.Error("CacheData.GetAvatar():" + ex.StackTrace);   /// Aatif 
  
          }
      }
      logger.Info("End--GetAvatar"); ///aatif
      return null;
  }
  
  
  
   string avatar = MURLEngine.GetAvatar();
  </code></pre>
  
  <p><strong>Showing Image in front end:</strong></p>
  
  <pre><code>  &lt;span id="ProfileImage"&gt;
                  &lt;img src="data:image/png;base64,@Model.avatarimage" /&gt;
  
              &lt;/span&gt;
  </code></pre>
  
  <p>How do i show the byte stream image on the front end? I am unable to do so right now.</p>