use vb.net function from classic asp page

K

Kent.Gallinger

I have a web application that contains asp.net and classic asp pages.
I have a vb.net function that I would like to use in one of the classic
asp pages. How can I do this? Can I do this?

Thanks,
Kent.
 
N

Nathan Sokalski

I am assuming that your Classic ASP page(s) use VBScript for the server-side
code. If this is true, then no, you can't. Because the .NET code is compiled
(you create a .dll file) and Classic ASP code is interpreted (it does not
require a compiler, you just need a web server that supports Classic ASP),
they server-side code cannot be shared between them. However, one thing that
could make it easier to write code that does the same thing for Classic ASP
is to use the same, or a similar, algorithm to write a version for VBScript.
This shouldn't be too hard since many of the basic constructs are the same
in VBScript and VB.NET. But my personal advice would be to simply convert
the Classic ASP page(s) to ASP.NET, it is not a good idea to mix Classic ASP
and ASP.NET. If you would like any help doing any of these things, let me
know, I have worked with Classic ASP, VBScript, ASP.NET, and VB.NET.
 
M

Michael D. Ober

Expose your .NET code as a COM object. Then both VBScript and JScript could
access it via CreateObject.

Mike Ober.
 
G

Guest

(e-mail address removed) wrote in @i39g2000cwa.googlegroups.com:
I have a web application that contains asp.net and classic asp pages.
I have a vb.net function that I would like to use in one of the classic
asp pages. How can I do this? Can I do this?

You can expose .NET DLLs as COM objects, then you can use them in classic
ASP via the Server.CreateObject("MyComObjectName") command.
 
J

Juan T. Llibre

Considering the inefficiency inherent in doing that, wouldn't it be better to write your
own functions, compile them to unmanaged dll's in VB6 or C++6 and run them natively ?
 
G

Guest

Considering the inefficiency inherent in doing that, wouldn't it be
better to write your own functions, compile them to unmanaged dll's in
VB6 or C++6 and run them natively ?

For most companies - probably not. VB6 is more or less obsolete... with
dwindling support from Microsoft. A lot of developers I know don't even
have Visual Studios 6.0 loaded on the machines anymore. For C++, we'll...
you'll need a C++ programmer. And with most companies I know, C++
programmers are dedicated to high priority projects or are expensive and
hard to come by.

So is the extra performance really worth the hassle?
 
J

Juan T. Llibre

re:
VB6 is more or less obsolete...

Yet, it's the only way to write unmanaged dll's for the web, other than C++.

You can't write COM objects with C#, however,
you can write COM objects with VB.NET :

http://msdn.microsoft.com/library/d...roughCreatingCOMObjectsWithVisualBasicNET.asp

That is bound to be more efficient than writing a wrapper class for a COM object
and using that, but the OP wanted to use VB.NET functions from classic ASP.

That will be a performance hit no matter how you slice it,
unless you write an unmanaged COM object and use it directly in classic ASP.

re:
So is the extra performance really worth the hassle?

That depends on how much performance you need.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top