Access custom objects from codebehind

Discussion in 'ASP .Net' started by MAG, May 12, 2004.

  1. MAG

    MAG Guest

    Hi,

    After using an assembly compiled into a DLL and added to the assembly
    cache for several months, we decided that it was too much trouble to
    maintain because of all the steps involved with every minor change
    (e.g. making the change, compiling, uploading the dll to the
    production server, opening vnc and running gacutil, etc...). I have 2
    questions associated with the problem, and depending on the answers,
    we'll decide what's best:

    1- Is there a way to unload the assembly from memory without
    restarting the server? From our experience, the only way we found for
    updating an assembly in the assembly cache is to restart the machine,
    otherwise, the assembly seems to stay in memory and the new dll file
    with the modifications is not taken into account.

    2- If we move all the dll source code into a single .vb file, is there
    a way to access the classes from codebehind? <% Assembly src... %>
    does not seem to work for that, the classes being accessible only in
    the aspx page and not in the aspx.vb code... With the dll in the
    assembly cache, we only had to use Import statement. How do you do
    "Import" classes from a .vb file?

    Thanx for any useful infos!

    MAG
    MAG, May 12, 2004
    #1
    1. Advertising

  2. MAG

    Curt_C [MVP] Guest

    depends on the OS of the server.
    With 2003 you can flush the app pool or restart the SITE as well.

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "MAG" <> wrote in message
    news:...
    > Hi,
    >
    > After using an assembly compiled into a DLL and added to the assembly
    > cache for several months, we decided that it was too much trouble to
    > maintain because of all the steps involved with every minor change
    > (e.g. making the change, compiling, uploading the dll to the
    > production server, opening vnc and running gacutil, etc...). I have 2
    > questions associated with the problem, and depending on the answers,
    > we'll decide what's best:
    >
    > 1- Is there a way to unload the assembly from memory without
    > restarting the server? From our experience, the only way we found for
    > updating an assembly in the assembly cache is to restart the machine,
    > otherwise, the assembly seems to stay in memory and the new dll file
    > with the modifications is not taken into account.
    >
    > 2- If we move all the dll source code into a single .vb file, is there
    > a way to access the classes from codebehind? <% Assembly src... %>
    > does not seem to work for that, the classes being accessible only in
    > the aspx page and not in the aspx.vb code... With the dll in the
    > assembly cache, we only had to use Import statement. How do you do
    > "Import" classes from a .vb file?
    >
    > Thanx for any useful infos!
    >
    > MAG
    Curt_C [MVP], May 12, 2004
    #2
    1. Advertising

  3. Some thoughts:

    You can unload an AppDomain, but you cannot unload an Assembly within an AppDomain. This means that
    all of the objects you get out of your Assembly will need to be Serializable since they cross domain
    boundaries.

    Here's an idea I had a while back, but haven't had the chance to think about further: You could put
    that .dll in some folder on the server. Then you could have a Windows Service app that monitors the
    file for changes; when there's a change, have it load the file into the GAC for you.

    Windows Explorer supports "drag-n-drop" install into the GAC; go do c:\<windows dir>\Assembly\ and
    drop the file in. This *does* work over NetBios too, so you can install on a remote box if you don't
    mind using that.

    I'm unsure about what you mean in #2. You have to add that dll to the "References" section of your
    project anyhow or it won't compile. If you just move all the code to the same project, you're done.
    If you're going to do that, why not just remove the thing from the GAC entirely and just drop it in
    the same directory as the app? (Less things to change/break)

    Granger


    MAG wrote:

    > Hi,
    >
    > After using an assembly compiled into a DLL and added to the assembly
    > cache for several months, we decided that it was too much trouble to
    > maintain because of all the steps involved with every minor change
    > (e.g. making the change, compiling, uploading the dll to the
    > production server, opening vnc and running gacutil, etc...). I have 2
    > questions associated with the problem, and depending on the answers,
    > we'll decide what's best:
    >
    > 1- Is there a way to unload the assembly from memory without
    > restarting the server? From our experience, the only way we found for
    > updating an assembly in the assembly cache is to restart the machine,
    > otherwise, the assembly seems to stay in memory and the new dll file
    > with the modifications is not taken into account.
    >
    > 2- If we move all the dll source code into a single .vb file, is there
    > a way to access the classes from codebehind? <% Assembly src... %>
    > does not seem to work for that, the classes being accessible only in
    > the aspx page and not in the aspx.vb code... With the dll in the
    > assembly cache, we only had to use Import statement. How do you do
    > "Import" classes from a .vb file?
    >
    > Thanx for any useful infos!
    >
    > MAG
    Granger Godbold, May 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Hungus

    codebehind and custom objects

    Karl Hungus, Feb 9, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    334
    Karl Hungus
    Feb 9, 2004
  2. vbMark
    Replies:
    5
    Views:
    439
    mortb
    Jun 30, 2004
  3. Replies:
    0
    Views:
    318
  4. 7stud
    Replies:
    11
    Views:
    674
    Dennis Lee Bieber
    Mar 20, 2007
  5. Nathan Baulch
    Replies:
    0
    Views:
    373
    Nathan Baulch
    Oct 25, 2007
Loading...

Share This Page