Solved

How do I create an user-defined asp object and use it ?

Posted on 2001-07-04
15
220 Views
Last Modified: 2011-04-14
Any tutorials URL or samples ?
0
Comment
Question by:weiyee08
  • 6
  • 4
  • 2
  • +2
15 Comments
 

Expert Comment

by:khurshid
ID: 6253660
0
 

Author Comment

by:weiyee08
ID: 6253913
khurshid,

any particular page in those URL ?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6254024
>>create an user-defined asp object

Are you trying to create something like an ActiveX so that you can do something like this?
Set objConn = Server.CreateObject("ADODB.Connection")


If that's the case, I recommend you use Visual Basic to create those dll.

1. Run Visual Basic

2. Choose ActiveX DLL as your project.

3. You may change the name of the project and the class file.

4. Type the below simple example to Class1.
Option Explicit

Private m_intNum1 As Integer
Private m_intNum2 As Integer

Public Property Let LetNum1(intNum1 As Integer)
    m_intNum1 = intNum1
End Property

Public Property Get GetNum1() As Integer
    GetNum1 = m_intNum1
End Property

Public Property Let LetNum2(intNum2 As Integer)
    m_intnum2 = intNum2
End Property

Public Property Get GetNum2() As Integer
    GetNum2 = m_intnum2
End Property

Public Function Add() As Integer
    Add = m_intNum1 + m_intnum2
End Function

5. Save the project.

6. Click File->Make Project1.dll. Project1.dll is created and registered in your registry.

7. Close the project.

Now code this in ASP
<%
Dim objAdd

Set objAdd = Server.CreateObject("Project1.Class1")
objAdd.LetNum1 = 1
objAdd.LetNum2 = 2
Response.Write objAdd.Add

Set objAdd = Nothing
%>

Your object is created! To make more complicated objects, you got to read Visual Basic books on ActiveX DLL.


hongjun
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6254026
I notice that questions posted by you are all of very little points.

hongjun
0
 

Author Comment

by:weiyee08
ID: 6254106
hongjun,

I am a new member in experts-exchange and I am taking some caution to
give points.
0
 

Author Comment

by:weiyee08
ID: 6254110
hongjun,

How can I get server variable like SCRIPT_NAME in an ActiveX project,
so I don't have to get it in ASP and pass it to ActiveX Dll for processing.
0
 

Author Comment

by:weiyee08
ID: 6254236
hongjun,

I got it, I know how to user Response and Request objects
in VB DLL.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:weiyee08
ID: 6254252
Hongjun,

I would like to edit my dll, so I typed :

regsvr32 /u test.dll, and I got this error :

 LoadLibrary("test.dll") failed
 GetLastError returns 0x00000485
0
 
LVL 1

Expert Comment

by:anupkarade
ID: 6254779
There is another way..
Instead of writing a dll you can write
the class in asp page itself..
along with the methods
and include the file on the page where you need it..
If you want a code I can supply it too...
By using this I have made a tree- type side menu

                       
        regards
                 Anup
0
 

Author Comment

by:weiyee08
ID: 6255011
anupkarade,

I prefer dll, because it run fastser
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6256163
I will be back tomorrow.

hongjun
0
 

Expert Comment

by:khurshid
ID: 6257173
If you have VB then select IIS application as your project. It allows you to create a dll and also supports dhtml/html documents to be incorporated with it while also providing support for server object.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7135355
A request has been made (http://www.experts-exchange.com/cleanup/Q_20320237.html) that this question be closed with the following resolution: points refund and PAQ

EXPERTS: Please leave any comment regarding this request here; I will return in seven (7) days to close the question.

Netminder
CS Moderator
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7163871
7 days has passed and I recommend a delete.

hongjun
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7163978
Per recommendation, points refunded and question closed.

Netminder
CS Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

27 Experts available now in Live!

Get 1:1 Help Now