Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7433107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:33:50+00:00 2026-05-29T09:33:50+00:00

I had the following code as per this question&answer How do I get the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:33:51+00:00Added an answer on May 29, 2026 at 9:33 am

    My guess would be that the .NET Framework installed on the server got upgraded, and the private constructor is no longer present under the new version.

    Assembly developers (in this case, Microsoft) are allowed to change any private (or internal) types or members at their whim, without it being considered to have been a breaking change.

    Edit: I checked on my PC under .NET 4.0, and the method is still present. This is its signature:

    // System.Web.MimeMapping
    internal static string GetMimeMapping(string FileName)
    

    At this point, my two suggestions would be to check your actual .NET version at runtime…

    var version = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
    

    …and to enumerate the methods of the MimeMapping class to check whether they correspond to what you expect:

    var methods = mimeMappingType.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
    

    Update: The good news is that the MimeMapping class and its GetMimeMapping method seem like they might be made public in .NET 4.5.

    However, this means that your code would definitely break, since you’re only searching for NonPublic methods. Try performing an all-inclusive search instead and see whether GetMimeMapping shows up:

    var methods = mimeMappingType.GetMethods(
        BindingFlags.Instance | 
        BindingFlags.Static | 
        BindingFlags.Public |
        BindingFlags.NonPublic | 
        BindingFlags.FlattenHierarchy);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I had to following file on my development branch: # file.rb class Code
I had the following code suggested to me. My question is to ask if
I had the following code in a sample application: ostream& operator<< (ostream& os, const
Say I had the following code: % Cellmode_subfunction_test.m %% Cell 1 foo(1); %% Cell
Recently I attended a lecture concerning some design patterns: The following code had been
I had no problem at all running the following code on a local server,
I had the following line snippet of code that searches for a propery of
I had the following HTML page rendering to use the Google Maps API. This
Why is this code invalid? typedef int INT; unsigned INT a=6; whereas the following
i had the following question. i want to update my subcategory select list when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.