Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use VB 6.0 to develop ASP Pages 2

Status
Not open for further replies.

campbere

Technical User
Oct 10, 2000
146
US
I am trying to find information on building VB COM objects, (I believe also called active x components) to develop ASP pages.

Specifically I am trying to find information on how a COM object is written to take the information a user types into a form and incorporates that into a VB COM ojbect. For example I have a screen that the user types in their username and password. I want to have a COM object that gets the values they typed and use them in the VB COM object.

If anyone can help I would appreciate it.

Thanks,

campbere
 
hi,

here is a simple example, assuming you have com object installed with a function named test:

----------------------------------------
set obj=server.createobject("comobject")

obj.test request.form

set obj=nothing

----------------------------------------

don't forget to do the set obj=nothing.

if you need more help, lemme know.

bill

 
The data passed in the form variabiles you can read with Request.Form("Variable name") if the form was passed through POST method or with Request.QueryString("Variable name") if the form was passed through GET method.

For the VB issue please read the thread
thread333-104034

Hope this helps, s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
I am still having problems with this. I have scaled down what I want to do to a simple example of grabbing the user id and password a user types into the web page and then having the VB COM function grab it and display it as a string (userid.pasword).

However I keep getting an error when I try to write my VB function. It has an error on the first line saying that an object is required.

Here is the code for the VB function :
Public Function LoginWeb()

Dim objConnection As String
Dim strUser As String
Dim strPassword As String

'The error occurs here
strUser = Request.Form(userid)
strPassword = Request.Form(password)

objConnection = strUser & "." & strPassword
LoginWeb = objConnection

End Function

Can either of you help?

If needed this the HTML snippet that creates the form

<form method=&quot;POST&quot; action=&quot;<table border=0>
<tr><p>
<td>User Id:</td>
<td><input name=&quot;userid&quot; type=&quot;TEXT&quot; size=&quot;14&quot; maxlength=&quot;20&quot; align=&quot;MIDDLE&quot;></td>
</tr></p>
<tr><p>
<td>Password:</td>
<td><input name=&quot;password&quot; type=&quot;TEXT&quot; size=&quot;14&quot; maxlength=&quot;20&quot; align=&quot;MIDDLE&quot;></td>
</tr></p>
</table>
<p> <input name=&quot;login&quot; type=&quot;SUBMIT&quot; value=&quot;Log In&quot; >
<input name=&quot;reset&quot; type=&quot;RESET&quot; value=&quot;Clear&quot;>
</P>

The LoginVerifcation.asp looks like this:

<%@ Language=VBScript %>
<%
'Varibles to establish Oracle Connection
Dim objVerifyLogin
Dim strHTML

Set objVerifyLogin = Server.CreateObject(&quot;Web.QueryPage&quot;)

strHTML = objVerifyLogin.LoginWeb

set objVerifyLogin = nothing
%>

<% =strHTML %>


I really appreciate all the help.
 
you were close. you need to pass the user id and password to your com object. here is how i would modify your LoginVerification.asp file:

<%@ Language=VBScript %>
<%
'Varibles to establish Oracle Connection
Dim objVerifyLogin
Dim strHTML

Set objVerifyLogin = Server.CreateObject(&quot;Web.QueryPage&quot;)

strHTML = objVerifyLogin.LoginWeb(request.form(&quot;userid&quot;), request.form(&quot;password&quot;))

set objVerifyLogin = nothing
%>

<% =strHTML %>

then in your vb code, make the following changes:

Public Function LoginWeb(strUser as variant, strPassword as variant)

Dim objConnection As String
remove the following two lines
' Dim strUser As String
' Dim strPassword As String

'The error occurs here
remove these too
' strUser = Request.Form(userid)
' strPassword = Request.Form(password)

objConnection = strUser & &quot;.&quot; & strPassword
LoginWeb = objConnection

End Function

hope that helps.
 
Are you getting the object context for your VB component?

You want to get the object context, and store it into a global variable for usage.

ex:
private goc as objectcontext
private gResponse as Response

public sub onstartpage()
set goc = getobjectcontext()
set gResponse = goc(&quot;Response&quot;)
'you can do gServer = goc(&quot;server&quot;)
'gRequest = goc(&quot;request&quot;) etc...
end sub

public sub onendpage()
set gResponse = nothing
set goc = nothing
end sub

look at these links:

for more info.
I'm not sure if the onstartpage and onendpage will work correctly in this context, since I use ObjectControl_Activate and ObjectControl_Deactivate for my MTS stuff.

hope this helps.
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top