Content-Type from file extension ?

  • Thread starter Thread starter Anony
  • Start date Start date
A

Anony

Hi All,

In VB6, I got the File Content-Type (image/gif ...) from Windows Registry.
Is there an easy way now in DotNet (i.e. from file extension)?

Another question: is the IE control (SHDocVw) a WinForm's control now in
VS2003? I know it wasn't in VS2002, needs InterOp.


Thanks and regards,
Anony
 
There is no way that I know of to determine content type from filename
supported directly by the .NET framework. Instead, you will have to either:

- lookup this information in the registry
- keep your own database of extensions to content type mappings and use this
to determine the content type for a file

HTH,
Kent
 
Back
Top