using System; using Microsoft.Win32; namespace Sleis.Utility { public static class MimeExtenstionUtility { public static string GetContentTypeByExtenstion(string ext) { string mimeType = "application/unknown"; ext = ext.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; } } }