title: What's wrong with this code? Display Image Using WCF Rest Service
body: <p>I want to display Image (.jpeg) on (Image control of Asp.Net) client side.  </p>
  
  <p>My rest service code is below, in which I am getting ImagePath from database.</p>
  
  <pre><code>public Stream getImage(string width, string height)
  {          
      int iRecordid = 1;           
      var q = from c in db.TblNames
              where c.RecordId == iRecordid
              select new { c.ImgName, c.ImgPath };
  
      foreach (var obj1 in q)
      {
          sImageName = obj1.ImgName;
          sImagePath = obj1.ImgPath;
      }           
      MemoryStream ms = new MemoryStream();
  
      ms.Position = 0;
      return ms;
  }
  </code></pre>
  
  <p>And I am using this service in Client side Like</p>
  
  <pre><code> public void getImage()
   {  
       string url = @"http://localhost:50353/CustomerService.svc/getImage/100/200";
  
       var service = new ServiceReference(url);
  
       WebClient wc = new WebClient();
  
       byte[] res1 = wc.DownloadData(url);
  
       Stream res2 = new MemoryStream(res1);
  
       DataContractJsonSerializer res3 = new DataContractJsonSerializer(typeof(ImageMap));
       string ss = res3.ReadObject(res2).ToString();
       Image1.ImageUrl = ss;
   }
  </code></pre>
  
  <p>I am getting error like</p>
  
  <blockquote>
    <p>There was an error deserializing the object of type System.Web.UI.WebControls.ImageMap. Encountered unexpected character 'ÿ'.</p>
  </blockquote>