title: Use HttpListener to get format of incoming data in .net
body: <p>I am writing a server-side program.
  I created a <code>HttpListener</code> to listen for incoming requests.
  How can I find out what kind of data is being sent in? E.g. is it a text, image, pdf, word?</p>
  
  <p>Pls correct my code below if it is wrong.
  I'm really new to this and my understanding of the HTTP concepts may be wrong. Thanks.</p>
  
  <pre><code>main()
  {
  HttpListener listener = new HttpListener();
  listener.Prefixes.Add("http://192.168.1.2/");
  listener.Start();
  
  while (true) //Keep on listening
  {
  context = listener.GetContext();
  HttpListenerRequest request = context.Request;
  
  //Do I get the request stream here, and do something with the stream to find out what data format is being sent?
  Stream requestStream = request.InputStream;
  }
  
  }
  </code></pre>