I am attempting to convert an asp file to a asp.net file using C#.
The original file has an ActiveX control which is contained in a cab file.
The cab file contains the .ocx file which connects to a socket and transfers
client info to a server, as well as several .dlls
The cab file also references another cab file which contains files to
install on the client machine in case they do not have VBRuntime6 installed
on their machine.
We have obtained a Microsoft license for the ActiveX control.
My problem is, how to call or reference the control in my .net page. I have
researched and am doing what I have seen, but am getting errors.
The original code has the ActiveX embedded in the html like so:
<form runat="server" name="trade_entry_verify" method="post">
..
..
..
<P>
<OBJECT CLASSID="clsid:blah_blah_blah"
id="Microsoft_Licensed_Class_Manager_1_0"1 VIEWASTEXT>
<PARAM NAME="LPKPath" VALUE="NAME.lpk">
</OBJECT>
<OBJECT id=IDNAME2 height=0 width=0
classid=clsid:blah_blah_blah codeBase="CABNAME.CAB#version=1,0,0,0"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="873">
<PARAM NAME="_ExtentY" VALUE="847">
</OBJECT>
</P>
..
..
..
</form>
One of the functions is like so (note- : trade_entry_verify is the form
name):
<script language="vbscript">
..
..
..
function doSubmit()
trade_entry_verify.IDNAME2.CloseSocket
trade_entry_verify.IDNAME2.HostAddress = "ip.address.0.0"
trade_entry_verify.IDNAME2.Port = "portnum"
Result = trade_entry_verify.citcp2.ConnectToHost
end function
..
..
..
</script>
In my C# code, I have embedded the two objects in the html as shown above
since the examples I have found seem to do the same.
Yet, when I try to preview the page in IE, I get the following error:
Compiler Error Message: BC30451: Name 'trade_entry_verify' is not declared.
Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: trade_entry_verify.CITCP2.CloseSocket
Line 88: trade_entry_verify.CITCP2.HostAddress = "ipaddressIuse"
Line 89: trade_entry_verify.CITCP2.Port = "2000"
trade_entry_verify is simply the form name, so I tried removing it and then
I get:
Compiler Error Message: BC30451: Name 'CITCP2' is not declared.
Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: CITCP2.CloseSocket
Line 88: CITCP2.HostAddress = "ipaddressIuse"
Line 89: CITCP2.Port = "2000"
for this page, to get started and for testing purposes, I simply cut and
pasted the VBScript function within the script tags. Ultimately, I wish to
rewrite it as C#.
Can anyone provide an example of how I should embed the ActiveX and license,
and then use it in a function? Any help would be really, really appreciated.