tornado
Keywords: ASP, ActiveX control, digital signature, security
Questions raised:
ActiveX control gets the client's information, how to pass to the server???
One method is to get a value, use GET, POST mode, which may be most common.
Is there a better way?
Can you get the data directly to the server directly to the server?
Open VB6, create a new ActiveX control project.
Engineering Name: FOCX, User Control Name: UC3
Add 1 button, 2 text boxes
code show as below:
Option expedition
Private submmand1_click ()
'Waices a part of the string and the number of words. Some differences
'Send your request by HTTP using asyncread
UserControl.asyncread "http: //yang/xml/activex.asp? S1 =" & text1.text & "", VBasyncTypebyteaRray
UserControl.asyncRead "http: //yang/xml/activex.asp? S1 =" & text1.text, vbasyncTypebyteaRray
End Sub
'AsyncReadComplete events are used to accept and analyze from ASP page.
'When the container just completes an asynchronous reading request?
The value in 'AsyncProp specifies a completed asynchronous data read request,
'It matches the data in the previous ASYNCREAD method call.
The error handling code should be included during the 'AsyncReadcomplete event process because the error status will terminate the download.
'If this happens, an error will occur when accessing the Value property of the AsyncProperty object.
Private sub UserControl_asyncReadcomplete (asyncprop as asyncproperty)
ON Error Goto Errhandle
Text2.text = ByteaRrayTostring (asyncprop.value)
Errhandle:
Err.raise 601, "Asynchronous reading has occurred", err.description
End Sub
'Convert byte arrays into strings
Public Function ByteArrayTostring (Bytarray () AS BYTE) AS STRING
DIM SANS AS STRING
Sans = STRCONV (Bytarray, Vbunicode)
ByteaRrayTostring = SANS
END FUNCTION
Let's take a look at http: //yang/xml/activex.asp this file
<%
DIM STR
Str = Request ("S1")
if str = "name" then
Response.write ("Tornado")
Elseif str = "agn" then
Response.write ("26")
Else
Response.write ("No information returned")
END IF
%>
Very simple, use the Request to accept parameters, response returns.
This example can be further processed to pass the server name to the control in a property.
For example:
Then get it in the program, you can use it, such as:
UserControl.asyncread "http://192.168.0.1/xml/activex.asp?s1=" & text1.text & "", VBAsynctypebyteArray then can be flexible in the program.