Calling dll's from ASP.Net
I need a little guidance as to converting an ASP page to ASP.Net. I've been
going through ASP.Net this week and I'm converting some of my ASP pages to
ASP.Net. I'm having a problem getting the ASP.Net page to use a dll that
is necessary to connect to our database (As/400). The page I'm starting
with is a simple ZipCode searching tool that passes search criteria to the
dll and returns an XML stream.
Everything works great in the ASP page but after converting most of the page
to ASP.Net I am getting an error when the code tries to create the instance
of my dll class.
Here is a copy of the code from the orginal ASP page with hardcoded values
that I am passing to the dll. "XMLZipSearch" is the function inside the
class.
Session("app") = Server.CreateObject ("ZipSearch.Class1")
app = Session("app")
RtCode = app.XMLZipSearch("TX", "78620", "78620", "Z")
I'm running a AMDK6 with NT/PWS as my web server and hitting it with a P-4
running Win2K. Remember that everything works great in the ASP page but not
in the ASP.Net page.
Any help would be very much appreciated.
Thanks,
Jon Gregory Rothlander
Re: Calling dll's from ASP.Net
I tried removing the Server.CreateObject and just use CreateObject but I
got a CreateObject is not declared error. Is there a reference I should be
making to use Server.CreateObject or CreateObject?
Thanks,
Re: Calling dll's from ASP.Net
Jon,
In order to use a COM DLL in ASP.NET, you need to generate metadata for the
component. You'll need to use the Type Library Importer; it comes with the
.NET SDK. First, the COM component must be properly registered. Next, you
need to run the Type Library Importer ("TlbImp"). This will create an assembly
usable by .NET.
Rich
--------------------------------------------------------------------------
"Jon Gregory Rothlander" <grothlander@austin400.com> wrote:
>
>I need a little guidance as to converting an ASP page to ASP.Net. I've
been
>going through ASP.Net this week and I'm converting some of my ASP pages
to
>ASP.Net. I'm having a problem getting the ASP.Net page to use a dll that
>is necessary to connect to our database (As/400). The page I'm starting
>with is a simple ZipCode searching tool that passes search criteria to the
>dll and returns an XML stream.
>
>Everything works great in the ASP page but after converting most of the
page
>to ASP.Net I am getting an error when the code tries to create the instance
>of my dll class.
>
>Here is a copy of the code from the orginal ASP page with hardcoded values
>that I am passing to the dll. "XMLZipSearch" is the function inside the
>class.
>
> Session("app") = Server.CreateObject ("ZipSearch.Class1")
> app = Session("app")
> RtCode = app.XMLZipSearch("TX", "78620", "78620", "Z")
>
>I'm running a AMDK6 with NT/PWS as my web server and hitting it with a P-4
>running Win2K. Remember that everything works great in the ASP page but
not
>in the ASP.Net page.
>
>Any help would be very much appreciated.
>
>Thanks,
>Jon Gregory Rothlander
>
>