title: C# WebAPI redirect to a Link that displays an Image
body: <pre><code>    public HttpResponseMessage getLogoPath(int ID)
      {
          String urlsubfix = dataManager.getMobileLogoPath(ID);
          String urlToReturn =  PictureController.urlprefix  +urlsubfix;
          var response = Request.CreateResponse(HttpStatusCode.Redirect);
          response.Headers.Location = new Uri(urlToReturn);
          return response;
      }
  </code></pre>
  
  <p>I want to have one of the API call to return an image, how I am accomplishing that is to redirect to another link that has the image,  for example :  </p>
  
  <p><a href="http://steve.files.wordpress.com/2006/03/Matrix%20tut%202.jpg" rel="nofollow noreferrer">http://steve.files.wordpress.com/2006/03/Matrix%20tut%202.jpg</a></p>
  
  <p>I am trying to use PostMan to test this and it gives me back a broken image. I tried derping around and still couldn't find a solution.</p>
  
  <p>-----Edit part of the code that needs this</p>
  
  <pre><code>    public HttpResponseMessage GetCustomerBarCodeLogo(String ID)
      {
          Barcode BC = new Barcode();
          Image img =BC.Encode(TYPE.CODE128, "123456789");
          HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
          ImageConverter imageConverter = new ImageConverter();
          byte[] resourceByteArray = (byte[])imageConverter.ConvertTo(img, typeof(byte[]));
          MemoryStream dataStream = new MemoryStream(resourceByteArray);
          result.Content = new StreamContent(dataStream);
          result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");
          return result; 
      }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Y8RiL.png" alt="Result from postman"></p>
  
  <p>This returns a broken image.</p>
  
  <p>------Newest Update</p>
  
  <p>I sort of found out the problem.  What happens is that there is a problem with SSL basic authentication.  What happens is when the first time the client wants to pass in a request, the authentication was set correctly.  However, when it tries to get an image which is another request after that is triggered by internal code, that request does not have autherizationHeader and it is not authenticated.  I don't know where is the 2nd event triggered so I don't know how to manually set that header.  </p>