5

I am developing a web application, Here I want to open .exe on client system from server, that means after hosting my site in IIS. Is it possible to open for example notepad or windows media player on client when the user clicks on a link on my web site?

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • For security reasons, you cannot do this. see some workarounds in http://stackoverflow.com/questions/1791511/run-exe-from-client-side – Visakh V A Sep 12 '16 at 06:39
  • If you had a program (console/winform) installed and operational on the client, that program could "Ping" the server for instructions in a form of net remoting. the Citrix programs are an example of this type of tech. But the user needs to install and be aware of what is happening for it to be white hat. – Shannon Holsinger Sep 12 '16 at 06:39
  • What exactly you want to do? Web application only can use `application protocol` to open specific application (https://en.wikipedia.org/wiki/Application_layer) – Prisoner Sep 12 '16 at 06:40
  • Do you want to open a document / file in its application or do you want to start an arbitrary executable ? – Ralf Bönning Sep 12 '16 at 06:50
  • Hi rboe. Here i want to open Document ,which is in client System.From Web application – Jithu –  Sep 12 '16 at 07:03

2 Answers2

5

This is not possible. And if it will be possible - it should be removed immediately. The reason for this is simple - security, it means almost everything if you working with browser.

If you want to launch some external executables - just make WPF or WinForms application client, and talk with WCF service. This way you will be free to use everything you want on client side.

eocron
  • 6,885
  • 1
  • 21
  • 50
1

It's a common scenario in some cases. mailto: url scheme is an example. When you click on such links, your default mail application will open. Or as another example you can see such feature in SharePoint applications which opens OneDrive for Business for synchronizing documents or use other office applications. Also skype: is another example.

To have such feature in your application you can use either of these options:

  1. You can register an application to a custom URI Scheme, then you can activate that application by the specified URL and pass parameters in URL. For more information take a look at:

  2. You can use a ClickOnce deployment by specifying an installation URL. Then you can simply open the application using that URL and pass parameters to the application using query string.
    For more information take a look at:

Warning

Be careful! You may introduce security holes to your application and clients. When passing data be careful about security vulnerabilities like Injection, Insecure Direct Object References, SensitiveData Exposure, and so on.

Especially if you want to use such protocols to create a middleware to open a program which is not yours, you should only expose a minimal secure set of features of that program and pend the operations to users confirmation. For example mailto: activates the mail program with some minimal data but doesn't send email. The users should press send themselves.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398