I had the following code as per this question&answer How do I get the MIME type of a file being requested in ASP.NET C#? and it was working perfectly fine:
static MimeMappingWrapper()
{
// dirty trick - Assembly.LoadWIthPartialName has been deprecated
//Assembly ass = Assembly.LoadWithPartialName("System.Web");
Assembly ass = Assembly.GetAssembly(typeof (HttpApplication));
Type mimeMappingType = ass.GetType("System.Web.MimeMapping");
GetMimeMappingMethod = mimeMappingType.GetMethod("GetMimeMapping", BindingFlags.Static | BindingFlags.NonPublic);
}
Now suddenly the mimeMappingType.GetMethod("GetMimeMapping", BindingFlags.Static | BindingFlags.NonPublic)
returns null
.
What could be the reason? Nothing special was changed in the application and even if it was, how could it influence this constructor for the wrapper class?