In my Windows service built using C #, I am trying to set mime types based on file extensions, as shown below.
static string GetMimeType(string fileName)
{
string mimeType = "application/unknown";
string ext = Path.GetExtension(fileName).ToLower();
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (regKey != null && regKey.GetValue("Content Type") != null)
mimeType = regKey.GetValue("Content Type").ToString();
return mimeType;
}
On the production server, we do not have Acrobat or the word installed for obvious reasons. How do I get around this? Is there any other way to set mime types? If not, how can I create these mime types on a production server without installing these programs.
Thanks in advance
source
share