public static string getContentType(string extension)
{
const string DEFAULT_CONTENT_TYPE = "application/unknown";
RegistryKey regkey, fileextkey;
string filecontenttype;
string fileextension = extension;
try
{
regkey = Registry.ClassesRoot;
fileextkey = regkey.OpenSubKey(fileextension);
filecontenttype = fileextkey.GetValue("Content Type", DEFAULT_CONTENT_TYPE).ToString();
fileextkey = null;
regkey = null;
}
catch
{
filecontenttype = DEFAULT_CONTENT_TYPE;
}
return filecontenttype;
}
Pass Exact contenttype like "pdf,txt,xmlns"