ASP.NET Classlibrary not instantiating properly in legacy ASP pages

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: ASP.NET Classlibrary not instantiating properly in legacy ASP pages

    In article <yKqdnZPHvccTZY-iU-KYvA@giganews.com>,
    [email]wwaggoner@companyname.com[/email] says...
    > Ok, I've been hung up on this issue for quite some time now and I would
    > like some help in getting it to work. I think this may be a setup issue
    > but I'd like to ask your eminences first.
    >
    > Here's some backstory: I need to create a VB.NET classlibrary (or another
    > structure) to use objects for our business logic. However, as our upgrade
    > is an ongoing process, I must enable this structure to be run in both ASPX
    > and ASP pages.
    >
    > Here's what goes wrong: I create a new solution. Create two projects, one
    > a ASP.NET web app, the other a classLibrary. I put a basic hello world
    > object into the classlibrary then get a return string from it in both an
    > ASP and ASPX page. Yes, the classlibrary has the build option checked to
    > "register for COM interop."
    >
    > Now, the ASPX page runs fine - but the ASP page gives me the following
    > cryptic error:
    >
    > Error Type:
    > (0x80070002)
    > /webApplication1/test1.asp, line 3
    >
    > Line 3 is the Server.CreateObject command for the object in question.
    >
    > No error string. The error code, when googled, reveals that it's "file not
    > found." That's about as useful as a kick in the ass. What am I doing
    > wrong? Why can't my ASP page use this object? If I can only get this
    > functional then I will have no further issues - we can start moving our
    > business logic and data logic from the legacy ASP pages to an object-based
    > back end. Please help!!
    I would strong-name the assembly and place it in the Global Assembly
    Cache (GAC). Since your library is a .NET library, the same rules for
    locating the assembly apply even when running in COM-interop: first the
    GAC is checked, then the current directory (based on the EXE running).

    Since your assembly isn't in the GAC, the only place to look would be
    the "current directory" of whatever process is running the ASP page (I'm
    not sure exactly which process that is). Placing it in the GAC will
    alleviate this problem.

    --
    Patrick Steele
    Microsoft .NET MVP
    [url]http://weblogs.asp.net/psteele[/url]
    Patrick Steele [MVP] Guest

  2. Similar Questions and Discussions

    1. Instantiating dynamic controls?
      I realize this is an old thread, but I stumbled onto this message and know the answer. instead of : myCanvas.createClassObject...
    2. Saving web pages properly?
      What is the best way to save a web page after editing it. The directions say file, menu, save as a web page, but "save as web page" doesn't show on...
    3. Instantiating a class in.NET
      Hi, I have a class in .Net which I instantiate in my code behind on one of my aspx pages. When I am finished with the instance, what is teh...
    4. instantiating the ASP.DLL
      Is there a way to do a CreateObject("") on the ASP.DLL? TIA Chris
    5. VB.NET classlibrary not instantiating properly in ASP pages
      Ok, I've been hung up on this issue for quite some time now and I would like some help in getting it to work. I think this may be a setup issue...
  3. #2

    Default Re: ASP.NET Classlibrary not instantiating properly in legacy ASP pages

    To add to Patricks suggestion, if you are putting it in the GAC to be used
    by ASP via Interop, or ASP.NET, then make sure you set your assembly culture
    information to be neutral, or your assembly probably wont load.

    --
    Regards

    John Timney (Microsoft ASP.NET MVP)
    ----------------------------------------------
    <shameless_author_plug>
    Professional .NET for Java Developers with C#
    ISBN:1-861007-91-4
    Professional Windows Forms
    ISBN: 1861005547
    Professional JSP 2nd Edition
    ISBN: 1861004958
    Professional JSP
    ISBN: 1861003625
    Beginning JSP Web Development
    ISBN: 1861002092
    </shameless_author_plug>
    ----------------------------------------------

    "Patrick Steele [MVP]" <patrick@mvps.org> wrote in message
    news:MPG.197cd05db22892c9897a5@msnews.microsoft.co m...
    > In article <yKqdnZPHvccTZY-iU-KYvA@giganews.com>,
    > [email]wwaggoner@companyname.com[/email] says...
    > > Ok, I've been hung up on this issue for quite some time now and I would
    > > like some help in getting it to work. I think this may be a setup issue
    > > but I'd like to ask your eminences first.
    > >
    > > Here's some backstory: I need to create a VB.NET classlibrary (or
    another
    > > structure) to use objects for our business logic. However, as our
    upgrade
    > > is an ongoing process, I must enable this structure to be run in both
    ASPX
    > > and ASP pages.
    > >
    > > Here's what goes wrong: I create a new solution. Create two projects,
    one
    > > a ASP.NET web app, the other a classLibrary. I put a basic hello world
    > > object into the classlibrary then get a return string from it in both an
    > > ASP and ASPX page. Yes, the classlibrary has the build option checked
    to
    > > "register for COM interop."
    > >
    > > Now, the ASPX page runs fine - but the ASP page gives me the following
    > > cryptic error:
    > >
    > > Error Type:
    > > (0x80070002)
    > > /webApplication1/test1.asp, line 3
    > >
    > > Line 3 is the Server.CreateObject command for the object in question.
    > >
    > > No error string. The error code, when googled, reveals that it's "file
    not
    > > found." That's about as useful as a kick in the ass. What am I doing
    > > wrong? Why can't my ASP page use this object? If I can only get this
    > > functional then I will have no further issues - we can start moving our
    > > business logic and data logic from the legacy ASP pages to an
    object-based
    > > back end. Please help!!
    >
    > I would strong-name the assembly and place it in the Global Assembly
    > Cache (GAC). Since your library is a .NET library, the same rules for
    > locating the assembly apply even when running in COM-interop: first the
    > GAC is checked, then the current directory (based on the EXE running).
    >
    > Since your assembly isn't in the GAC, the only place to look would be
    > the "current directory" of whatever process is running the ASP page (I'm
    > not sure exactly which process that is). Placing it in the GAC will
    > alleviate this problem.
    >
    > --
    > Patrick Steele
    > Microsoft .NET MVP
    > [url]http://weblogs.asp.net/psteele[/url]

    John Timney \(Microsoft MVP\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139