public static string GetFileContentType(string filename)
{
string[] array = filename.Split('.');
string result = string.Empty;
string suffix="."+array[array.Length-1];
RegistryKey rg = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(suffix);
object obj=rg.GetValue("Content Type");
result =obj!=null?obj.ToString():string.Empty;
rg.Close();
return result;
}
{
string[] array = filename.Split('.');
string result = string.Empty;
string suffix="."+array[array.Length-1];
RegistryKey rg = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(suffix);
object obj=rg.GetValue("Content Type");
result =obj!=null?obj.ToString():string.Empty;
rg.Close();
return result;
}
浙公网安备 33010602011771号