title: How to return multipart/form-data in response from WCF service?
body: <p>In my WCF service I need to return MIME Multipart data (a text file) back to client in the response. Althoug the response returned to the client, I don't see the data being returned. As a matter of fact, I don't see anything I setup on the server side being returned to the client. Could someone shed some light on this? Here is what I have in my code for building and returning response:</p>
  
  <pre><code>        MultipartFormDataContent formData = new MultipartFormDataContent("myboundary");
          HttpResponseMessage responseMsg = new HttpResponseMessage();
          try
          {
              using (Stream fs = File.OpenRead("C;\\mydata.txt"))
              {
                  formData.Add(new StreamContent(fs), "Payload", "mydata.txt"); 
              }
          }
          catch (Exception ex)
          {
              ServiceUtil.LogMessage(ex.Message);
          }
          responseMsg.StatusCode = System.Net.HttpStatusCode.OK;
          responseMsg.Content = formData;
  
          WebOperationContext.Current.OutgoingResponse.ContentLength = 2048;
          WebOperationContext.Current.OutgoingResponse.ContentType = "multipart/form-data";
          WebOperationContext.Current.OutgoingResponse.Headers["Accept"] = "multipart/form-data";
      }
  </code></pre>