Solved

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

Posted on 2004-08-29
3
621 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now