title: Get file MIME type?
body: <p>I am writing advanced html server for my own purpose. Now i reached problem when specifying file type. Currently i determinate file type by extension</p>
  
  <p>My function code:</p>
  
  <pre><code>Select Case extension.ToLower()
     Case ".avi"
        Return "video/x-msvideo"
     Case ".css"
        Return "text/css"
     Case ".doc"
        Return "application/msword"
     Case ".htm", ".html"
        Return "text/html"
        ...
     Case Else
        Return "application/octet-stream"
  End Select
  </code></pre>
  
  <p>I use it like that:</p>
  
  <pre><code>Dim context as Net.HttpListenerContext
  Dim file as String
  context.Response.ContentType = getFileType(Path.GetExtension(file))
  </code></pre>
  
  <p>I accept answers also in C#</p>
  
  <p>Edit:
  My question is how i can simply get file type without registry and case?</p>