Run client side .exe file from server side using | Coding Cluster - using, c#, mvc 4, iphone, php, ios, javascript, in mvc 3 & more

Run client side .exe file from server side using


                                                                   In one of my project my clients requirements is scanning a document from local scanner and directly upload into the server through web application. But there is no direct method to access local machine from sever code in dot net, so we need some other solutions to access local .exe (to activate scanner) file from server.

Finally Google answering me "ActiveX0bject". Yes we can run .exe file from server by using ActiveX shell command. Here is the sample code to run client's side .exe file from server  by using JavaScript and ActiveX0bject.

Enable ActiveX controls in IE for run .exe files from local :
                                Before  we enable ActiveX in IE settings with the following simple steps, 
Step -1: Open IE -->Tools --> Internet Options

Step -2:  Go to security tab choose your zone (Internet (OR) Local)  then click custom Level button

Step-3:  Just set "The Initialize and script ActiveX controls not marked as safe" as "Prompt"


 And the following JavaScript code is for run .exe (In my case "ImageScanner.exe")file with parameter session id, display order  and user id.

JavaScript Code 

function runScaningApp(sessId, disorder, userId){

var shell=new ActiveX0bject("");

var res ='"ImageScanner.exe" "'+ sessId +'" "'+ disorder+'" "'+ userId+'", '1', true);

 if (res == "0"){
   alert ("Your success message");
   alert ("Sorry! Some error occurred");


Post a Comment

Share your thoughts here...




Blogger Widgets