Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Using a GAC-registered assembly in a web application

Using a GAC-registered assembly in a web application

Scheduled Pinned Locked Moved .NET (Core and Framework)
questiondotnetsecurityhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tiwal
    wrote on last edited by
    #1

    Hello , I am currently working on a project which requires the use of a custom dll for authentication. This dll is registered (so they told me) in the GAC of both the Production and Test environments. The company policies state that you "shouldn't include the dll reference in your application's web.config file", that is, you shouldn't have something like : etc. in your web.config, at least for this dll I am talking about. They say, since it's registered in the GAC, the application will load it anyway. The problem is , if you don't add the assemby reference in your web .config , the application is not going to find it , no matter what they say. Since I am sure the dll is actually registered in the GAC, my question is : shouldn't the application be able to load the dll anyway , no matter if you add the reference in the web.config or not ? I was convinced that, adding the reference to the project, the dll 's GAC location would be stored in the application's assembly so that the application itself would be able to find the assembly in the GAC , no matter what the working system is , given that the dll is actually registered in the working system's GAC . But I must be wrong. What is the real way it works ? Thanks Leo

    L 1 Reply Last reply
    0
    • T tiwal

      Hello , I am currently working on a project which requires the use of a custom dll for authentication. This dll is registered (so they told me) in the GAC of both the Production and Test environments. The company policies state that you "shouldn't include the dll reference in your application's web.config file", that is, you shouldn't have something like : etc. in your web.config, at least for this dll I am talking about. They say, since it's registered in the GAC, the application will load it anyway. The problem is , if you don't add the assemby reference in your web .config , the application is not going to find it , no matter what they say. Since I am sure the dll is actually registered in the GAC, my question is : shouldn't the application be able to load the dll anyway , no matter if you add the reference in the web.config or not ? I was convinced that, adding the reference to the project, the dll 's GAC location would be stored in the application's assembly so that the application itself would be able to find the assembly in the GAC , no matter what the working system is , given that the dll is actually registered in the working system's GAC . But I must be wrong. What is the real way it works ? Thanks Leo

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Global Assembly Cache | Microsoft Docs[^]

      MSDN wrote:

      The Global Assembly Cache stores assemblies specifically designated to be shared by several applications on the computer.

      tiwal wrote:

      I was convinced that, adding the reference to the project, the dll 's GAC location would be stored

      The GAC location doesn't need to be stored; it is managed by the .NET environment. You will still need to add a reference to the dll. The difference is that you no longer have to copy the dll to the local output folder (which VS does for you, usually), but that the app will use the one that is registered in the GAC.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

      T 1 Reply Last reply
      0
      • L Lost User

        Global Assembly Cache | Microsoft Docs[^]

        MSDN wrote:

        The Global Assembly Cache stores assemblies specifically designated to be shared by several applications on the computer.

        tiwal wrote:

        I was convinced that, adding the reference to the project, the dll 's GAC location would be stored

        The GAC location doesn't need to be stored; it is managed by the .NET environment. You will still need to add a reference to the dll. The difference is that you no longer have to copy the dll to the local output folder (which VS does for you, usually), but that the app will use the one that is registered in the GAC.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

        T Offline
        T Offline
        tiwal
        wrote on last edited by
        #3

        Hi Eddy thanks for answering. You mean that I still need the tag in the application's web.config ? Doesn't the application's assembly contain a reference itself ? The production cluster specialists in my company scolded me for putting the tag in the web. config, but then I showed them how it would behave without it, and they were baffled ....

        L 1 Reply Last reply
        0
        • T tiwal

          Hi Eddy thanks for answering. You mean that I still need the tag in the application's web.config ? Doesn't the application's assembly contain a reference itself ? The production cluster specialists in my company scolded me for putting the tag in the web. config, but then I showed them how it would behave without it, and they were baffled ....

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          tiwal wrote:

          You mean that I still need the <add assembly="" ...=""> tag in the application's web.config ? Doesn't the application's assembly contain a reference itself ?

          It does for WinForms; the references are part of the project-file, and compiled into the assembly. I'd assume ASP.NET does the same. How the Runtime Locates Assemblies | Microsoft Docs[^] seems to suggest that the config-files are the first location where the runtime looks.

          tiwal wrote:

          The production cluster specialists in my company scolded me for putting the <add assembly="" ..=""> tag in the web. config

          Why? Any specific reason why it is considered "bad"?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          T 1 Reply Last reply
          0
          • L Lost User

            tiwal wrote:

            You mean that I still need the <add assembly="" ...=""> tag in the application's web.config ? Doesn't the application's assembly contain a reference itself ?

            It does for WinForms; the references are part of the project-file, and compiled into the assembly. I'd assume ASP.NET does the same. How the Runtime Locates Assemblies | Microsoft Docs[^] seems to suggest that the config-files are the first location where the runtime looks.

            tiwal wrote:

            The production cluster specialists in my company scolded me for putting the <add assembly="" ..=""> tag in the web. config

            Why? Any specific reason why it is considered "bad"?

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

            T Offline
            T Offline
            tiwal
            wrote on last edited by
            #5

            Eddy Vluggen wrote:

            Why? Any specific reason why it is considered "bad"?

            Well I assume they, like me, were expecting everything to work fine without the need to add the specified tags to the web.config ... appearently, we both were wrong....

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups