473,221 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

including activeX within ASP

Hi all,

I have some activeX code that I use to get the local computer name. (I don't
think this is possible using ASP from my research).

The rest of my code is ASP. I'd like to know how to pass the ActiveX
variable into my ASP script. My code is as follows. Thanks.

-----------------
activeX code: (I have this saved as activeX.asp which seems to work fine)

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
</script>
-----------------

ASP code:

<% @ Language="VBScript" %>

<% Option Explicit

'declare your variables
dim connection
dim sSQL,sConnString
dim Username

If Request.ServerVariables("LOGON_USER") = "" Then
Response.Status = "401 access denied"
End If
Username=(Request.ServerVariables("LOGON_USER"))
'declare SQL statement that will query the database
'sSQL="INSERT INTO Log (FirstName, SurName) VALUES (Username, 'Wall')"

sSQL="INSERT INTO Log (Name) VALUES ('" & replace(Username,"'","''") & "')"
'define the connection string, specify database
' driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("ServerLog.mdb") & ";"

'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

'check to see if there were any errors
If err.number=0 Then
response.write "the data was inserted successfully."
Else
response.write "there was a problem entering the data."
End If

'close the object and free up resources
Connection.Close
Set Connection = Nothing
%>
Jul 19 '05 #1
7 2701
I am assuming that the ActiveX component will be running in the browser and
not on the server. You will have to send a new request to the server after
you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Newbie" <Ne****@nospam.com> wrote in message
news:63H5c.3348$a95.386@newsfe1-win...
Hi all,

I have some activeX code that I use to get the local computer name. (I don't think this is possible using ASP from my research).

The rest of my code is ASP. I'd like to know how to pass the ActiveX
variable into my ASP script. My code is as follows. Thanks.

-----------------
activeX code: (I have this saved as activeX.asp which seems to work fine)

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
</script>
-----------------

ASP code:

<% @ Language="VBScript" %>

<% Option Explicit

'declare your variables
dim connection
dim sSQL,sConnString
dim Username

If Request.ServerVariables("LOGON_USER") = "" Then
Response.Status = "401 access denied"
End If
Username=(Request.ServerVariables("LOGON_USER"))
'declare SQL statement that will query the database
'sSQL="INSERT INTO Log (FirstName, SurName) VALUES (Username, 'Wall')"

sSQL="INSERT INTO Log (Name) VALUES ('" & replace(Username,"'","''") & "')"

'define the connection string, specify database
' driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("ServerLog.mdb") & ";"

'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

'check to see if there were any errors
If err.number=0 Then
response.write "the data was inserted successfully."
Else
response.write "there was a problem entering the data."
End If

'close the object and free up resources
Connection.Close
Set Connection = Nothing
%>

Jul 19 '05 #2
Thanks for your reply.

The activeX will be running client side in their browser yes (because I need
it to grab their computer name and not the server's computer name).

My ASP page will also contain (when completed) a form for the user to fill
in. Once they click submit I want all the data gathered including the local
computer name to insert into the database.

I wanted the user just to run the ASP page, and for the ASP page to run the
activeX component behind the scenes.

Is this possible?

Cheers.

Mark Schupp wrote:

I am assuming that the ActiveX component will be running in the browser and not on the server. You will have to send a new request to the server after
you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>

Jul 19 '05 #3
No. You need two pages. The first is just an HTML page containing the
client-side code and the ActiveX Component , if there is one. The page may
be generated from ASP but there isn't any point in doing that. Just straight
HTML with the right client-side script is all that is needed.

The HTML page will do an autorefresh that calls the second (ASP) page and
passes the machinename to the ASP. The ASP page contains the Form and the
stored value for the machine name (session variable, hidden form field,
however you choose). The form is then submitted with the new data plus the
machine name.
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"Newbie" <Ne****@nospam.com> wrote in message
news:fFH5c.3540$a95.2468@newsfe1-win...
Thanks for your reply.

The activeX will be running client side in their browser yes (because I need it to grab their computer name and not the server's computer name).

My ASP page will also contain (when completed) a form for the user to fill
in. Once they click submit I want all the data gathered including the local computer name to insert into the database.

I wanted the user just to run the ASP page, and for the ASP page to run the activeX component behind the scenes.

Is this possible?

Cheers.

Mark Schupp wrote:

I am assuming that the ActiveX component will be running in the browser

and
not on the server. You will have to send a new request to the server after you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>


Jul 19 '05 #4
"Autorefresh" may not have been the best choice of words, but you should be
able to see the intent.
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"Phillip Windell" <@.> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
No. You need two pages. The first is just an HTML page containing the
client-side code and the ActiveX Component , if there is one. The page may
be generated from ASP but there isn't any point in doing that. Just straight HTML with the right client-side script is all that is needed.

The HTML page will do an autorefresh that calls the second (ASP) page and
passes the machinename to the ASP. The ASP page contains the Form and the
stored value for the machine name (session variable, hidden form field,
however you choose). The form is then submitted with the new data plus the
machine name.
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"Newbie" <Ne****@nospam.com> wrote in message
news:fFH5c.3540$a95.2468@newsfe1-win...
Thanks for your reply.

The activeX will be running client side in their browser yes (because I

need
it to grab their computer name and not the server's computer name).

My ASP page will also contain (when completed) a form for the user to fill
in. Once they click submit I want all the data gathered including the

local
computer name to insert into the database.

I wanted the user just to run the ASP page, and for the ASP page to run

the
activeX component behind the scenes.

Is this possible?

Cheers.

Mark Schupp wrote:

I am assuming that the ActiveX component will be running in the
browser and
not on the server. You will have to send a new request to the server

after you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>



Jul 19 '05 #5
put the activex component on the same page as the form.
include a hidden field in the form for the computername
use javascript to get the name from the activex component and put it in the
hidden form field
when the form is submitted the computer name will be available to the form
processing script.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Newbie" <Ne****@nospam.com> wrote in message
news:fFH5c.3540$a95.2468@newsfe1-win...
Thanks for your reply.

The activeX will be running client side in their browser yes (because I need it to grab their computer name and not the server's computer name).

My ASP page will also contain (when completed) a form for the user to fill
in. Once they click submit I want all the data gathered including the local computer name to insert into the database.

I wanted the user just to run the ASP page, and for the ASP page to run the activeX component behind the scenes.

Is this possible?

Cheers.

Mark Schupp wrote:

I am assuming that the ActiveX component will be running in the browser

and
not on the server. You will have to send a new request to the server after you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>


Jul 19 '05 #6
Thanks for the replies - sounds like I have a plan now.

As my username suggests it will take some research on my behalf to do this.
If you could point me in the right direction...especially for the javascript
bit then I'd appreciate it.

Thanks.
"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...
put the activex component on the same page as the form.
include a hidden field in the form for the computername
use javascript to get the name from the activex component and put it in the hidden form field
when the form is submitted the computer name will be available to the form
processing script.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Newbie" <Ne****@nospam.com> wrote in message
news:fFH5c.3540$a95.2468@newsfe1-win...
Thanks for your reply.

The activeX will be running client side in their browser yes (because I

need
it to grab their computer name and not the server's computer name).

My ASP page will also contain (when completed) a form for the user to fill
in. Once they click submit I want all the data gathered including the

local
computer name to insert into the database.

I wanted the user just to run the ASP page, and for the ASP page to run

the
activeX component behind the scenes.

Is this possible?

Cheers.

Mark Schupp wrote:

I am assuming that the ActiveX component will be running in the
browser and
not on the server. You will have to send a new request to the server

after you obtain the computer name.

<Script language="vbscript">
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
this.location="yourasp.asp?computername=" & sComputername
</script>



Jul 19 '05 #7
Yes i'm having thesame problem. If anyone knows the answer plss tell us :)

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: dw85745 | last post by:
PROBLEMS I Haven't solved: 1. Timing issue between real-time server #1 and my drawing tools. Will moving the tools (currently within module) to an ActiveX (exe or DLL) solve the problem or...
2
by: Chaduke | last post by:
I wrote a simple client/server chat program and the client runs as an activex control within an asp page. I have the users logging into the page using widows authentication and I'm using...
7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
0
by: Ted | last post by:
I'm using a 3rd party ActiveX control which has it's own constructor and two very methods (which ultimately sends out messages on the server's USB or serial port). I am trying to run this ActiveX...
1
by: Rocio | last post by:
I have a windows app. written in VB6, now we need to expose some of its classes through a web service. I am only able to expose the classes using late binding becasue that's the way the original...
4
by: Steve Lloyd | last post by:
Hi, This is a bit of lame question but is something I have been struggling with for a while. I am struggle to find a way to develop ActiveX components, I seem to remember doing them in VS 6.0...
1
by: Frank | last post by:
Short Version of Question: Can anyone provide an example of how I should embed the ActiveX and license, and then use it in a function?
1
by: OfurGørn | last post by:
I am creating an ActiveX control that should contain a reference to a certain COM interface. I have written before a C# application containing this COM interface but my problem is that it seems...
0
by: LorenVS | last post by:
Hello Everybody, I'm new here, and I'm hoping someone can help me out... I'm creating an ActiveX control for an company intranet. This control needs to access Microsoft Outlook (specifically...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.