0

I have a website in asp.net with VB, and I have a link to a medical program that is installed in PC, when I click the link I want to execute the .exe for this program. I found this code but it´s works only when my project is locally:

 System.Diagnostics.Process.Start("C:\Windows\System32\MiProgram.exe")

I also tried with this code:

 Dim OpenDoc As ProcessStartInfo = New ProcessStartInfo
 Dim stPath As String = "C:\Windows\System32\MiProgram.exe"
 OpenDoc.FileName = stPath
 OpenDoc.Verb = "open"
 OpenDoc.WindowStyle = ProcessWindowStyle.Normal
 Process.Start(OpenDoc)

Both codes works locally, but when I get my project to the web, does nothing

I also read that I can enable de IIS Service, I follow the steps of this page, but is not use to me.
Is there any solution to this problem?

I accept suggestions. Thanks.

Teejay
  • 7,210
  • 10
  • 45
  • 76
Esraa_92
  • 1,558
  • 2
  • 21
  • 48
  • Seems rights issue, this post may help you. – Adil Jun 30 '16 at 07:19
  • 1
    You cannot start an EXE file if user click it on the browser. It is a security measure. All browser will block it, even to download is today not always possible without tons of warnings. –  Jun 30 '16 at 07:19
  • 1
    Apologies for not adding the link to post, here it is, http://stackoverflow.com/questions/13658555/need-to-execute-exe-in-server-from-asp-net – Adil Jun 30 '16 at 07:22
  • Your code will run the program on the server, not on the client. This is why it "works" locally. – KevinM Jun 30 '16 at 07:22
  • @Stanley , I know that is a security measure, but I thought that is there any way in the client pc to enable to open links, this pc is only to execute this program, it will not be a computer to surf the Internet or use other tools – Esraa_92 Jun 30 '16 at 07:24
  • @KevinM , yes your right but I want to know is there any posibility to connect the client pc? – Esraa_92 Jun 30 '16 at 07:25
  • Possible duplicate of [How to execute an application on the client from a website?](http://stackoverflow.com/questions/7814339/how-to-execute-an-application-on-the-client-from-a-website) – Andrew Morton Jun 30 '16 at 10:15
  • @Esraa_92 in order to run an exe on a machine, last web browser supports this is IE8, and this can be done using ActiveX controls, if you can ask who ever using this web site to use IE8 its doable :) – Sufyan Jabr Jul 03 '16 at 05:25

3 Answers3

1

Unfortunately, it is not possible to run a program on the client from server-side. There is already some discussions about that, here is some links :

How to execute an application on the client from a website?

Run an exe in client machine from a website

Executing exe on client side using C#

Community
  • 1
  • 1
KevinM
  • 144
  • 3
  • 13
1

You can do this with a work around..

You create a running Windows Forms application, on that application you host a wcf services, check this link as sample.

Expose a method like `RunApplication' put the same code their, where you can call it from your website, this will 100% work.

Community
  • 1
  • 1
Sufyan Jabr
  • 791
  • 4
  • 20
  • Thank you for your answer, do you have another examples to show that? thanks – Esraa_92 Jul 04 '16 at 09:30
  • 1
    @Esraa_92 is already included a sample code, for your page ( according to this sample) you will be calling using ajax http://localhost:8080/MyWcfService/ – Sufyan Jabr Jul 04 '16 at 09:44
0

You can try by implementing this settings:

In IIS 7/8 go Control Panel / Program And Features / Turn Windows features on or off, and check all items from: Web Managment Tools, (it's include: IIS Managment Service, II 6 Managment Compatibility)

Rahul Hendawe
  • 902
  • 1
  • 14
  • 39