Solved

Is it possible to create ASP COM Objects in vb.net?

Posted on 2004-08-29
3
626 Views
Last Modified: 2007-12-19
Hi there, I'm sure this is probably a stupid question, but for various reasons, I need to access a VB.NET object from within a standard ASP page. Is it possible to even do this and can anyone point me in the right direction of how to do it?

I have so far created a VB.NET class as follows:

Public Class LeapYear2

    Public Function GetDate() As Date
        ' Return today's date
        Return Today
    End Function

End Class

I then created a DLL which i registered using REGASM which seemed to work. I then created an ASP page with the following line in it:

Set oCheckYear = CreateObject("comtest3.LeapYear2")

However, when I run it I get the following error:

Error Type:
(0x80070002)
/comtest.asp, line 8

Any ideas - I feel like I'm banging my head against a wall at the moment!

John.
0
Comment
Question by:cobrajohn123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Timbo87 earned 150 total points
ID: 11927022
You need a create a COM callable wrapper (CCW) for your .NET component in order to use it with ASP, VB6, etc.

The first part of this article explains how to do it:
http://www.c-sharpcorner.com/articles/accessingdotnetfromcom.asp

Here's another article that deals with ASP specifically:
http://www.dnzone.com/ShowDetail.asp?NewsId=126
0
 

Author Comment

by:cobrajohn123
ID: 11929725
Those articles are brilliant, but I still can't make it work... I now get the ASP error:

Server Object, ASP 0177 (0x800401F3)
Invalid class string
/comtest.asp line3

I guess the ASP page cannot see the .NET / COM component I have created, even though I followed every line of the articles you suggested... any more ideas?

John.
0
 

Author Comment

by:cobrajohn123
ID: 11930137
Hiya - sorted it now - it seems that the example listed is lightly wrong in that the name of the component is wrong...

anyway - it works now - thanks for the pointer...

John.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question