1. Run the ASP Client Program :
----------------------------------------------------------
ASP runs applications locally through Windows Script Host. There are two available scripting languages: JS and vbs,
The following describes how to run applications in JS and vbs respectively. Code :
[JS]
<Script language = "JavaScript">
<! --
Function rexe (pexe ){
VaR pcmd = new activexobject ("wscript. Shell ");
VaR rexe = pcmd. Exec (pexe );
-->
}
</SCRIPT>
<! --Replace the following ework.exe with your local program path -->
<Input id = rexe type = button style = "Groove" value = "run" onclick = "rexe ('C: \ test \ ework.exe ')">
[Vbs]
<Script language = "vbs">
Function rexe (pexe)
Set pcmd = Createobject ("wscript. Shell ")
Set rexe = pcmd. Exec (pexe)
Set rexe = nothing
End Function
</SCRIPT>
<! --Replace the following ework.exe with your local program path -->
<Input type = button style = "Groove" value = "run" onclick = "rexe ('C: \ test \ ework.exe ')">
To create a wscript sub-object, you must register a DLL file that supports the Automation server and register the command regsvr32 scrrun. dll.
In addition, due to security restrictions, some clients may still encounter the error message "The Automation server cannot create objects" during browsing, this is because the security option in the Intranet option disables "initializing and running scripts for ActiveX controls that are not marked as secure". There is no way to change it to a prompt, or enable it if you are not afraid of danger (no prompt is displayed). We strongly recommend that you do not do this :)
2. Run the server program in ASP:
----------------------------------------------------------
However, when disabling unsigned ActiveX controls, you still cannot use them.
<Script language = "JavaScript">
Run_exe = "<Object ID = \" Runit \ "width = 0 Height = 0 type = \" application/X-oleobject \""
Run_exe + = "codebase = \" test.exe # version = 1, 1, 1 \ ">"
Run_exe + = "<Param name = \" _ version \ "value = \" 65536 \ ">"
Run_exe + = "</Object>"
Run_exe + = "<HTML> Document. open ();
Document. Clear ();
Document. writeln (run_exe );
Document. Close ();
</SCRIPT>