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
My function 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
I use it like that:
Dim context as Net.HttpListenerContext
Dim file as String
context.Response.ContentType = getFileType(Path.GetExtension(file))
I accept answers also in C#
Edit: My question is how i can simply get file type without registry and case?
 
     
    