Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch an EXE from Web page (asp.net)

This is an internal web application where we would like the Web pages to contain links to several utilities that are Win32 EXE. The EXEs are trusted and produced by us. (don't care if it asks if its ok to Run or Save). I tried direct link (e.g. C:\notepad.exe) which works locally only. (This will be a share on the network). Tried File:/// and did not work. IE7 is the browser needed.

like image 505
JoeJoe Avatar asked May 27 '09 17:05

JoeJoe


People also ask

Can you run an exe from a browser?

So you really can't launch .exe files from a browser with any much success - it simply a security hole the size of open barn door. You might get some success opening up some trusted locations for the browser - but it is a difficult challenge at best.


2 Answers

This assumes the exe is somewhere you know on the user's computer:

<a href="javascript:LaunchApp()">Launch the executable</a>  <script> function LaunchApp() { if (!document.all) {   alert ("Available only with Internet Explorer.");   return; } var ws = new ActiveXObject("WScript.Shell"); ws.Exec("C:\\Windows\\notepad.exe"); } </script> 

Documentation: ActiveXObject, Exec Method (Windows Script Host).

like image 191
JLopez Avatar answered Sep 28 '22 17:09

JLopez


How about something like:

<a href="\\DangerServer\Downloads\MyVirusArchive.exe"    type="application/octet-stream">Don't download this file!</a> 
like image 35
Cerebrus Avatar answered Sep 28 '22 17:09

Cerebrus