I am using ActiveXObjects to launch an exe in my asp.net application, but that is not the most handsome solution that I came across as it is limited to be used in Internet Explorer and soon ActiveXObjects will be obsolete.
Is there a better way to achieve this(launching exe from an asp.net application) in asp.net application.
Knowing your exact scenario could help. For example if you have to, you could associate a client side app with a particular file extension. What does this app ?
there is no better way. browser security has removed this feature. as you suggested this feature will also disappear in future versions of IE.
if you control the exe code, then a long term solution is to have the exe register a mime-type it responds to. the the web application could download a message of they mimic-type and the browser would open the application.
note: if this is an internal app, then you should write a launcher application, that registers a mimic-type that users install, and the payload could identify the exe to run.
Sir, I guess that you are looking for this, then it executes the .exe application;
Simple Working Example:
class Program {
static void Main(string[] args) {
Notepad np = new Notepad();
Thread th = new Thread(new ThreadStart(np.startNPprocess));
th.Start();
Console.WriteLine("press [enter] to exit");
Console.ReadLine();
}
}
public class Notepad {
public void startNPprocess() {
Process pr = new Process();
ProcessStartInfo prs = new ProcessStartInfo();
prs.FileName = @"notepad.exe";
pr.StartInfo = prs;
pr.Start();
}
}
With regards, Angelina Jolie
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
This approach suggested by you does not work if the web application is hosted on IIS because app pool does not allow exe to run on the server. I need to run my exe on the client side. So, I need some code which runs the exe on the client side.
The exe code is in my control as it is a WPF app which is created by my team only. I just want to launch that WPF app exe from a different web application.
The approach suggested by you looks interesting, I would appreciate if you can share a link where I can study in detail the approach suggested.
Exact scenarios is, we have created a WPF app and created an exe of the same using ClickOnce. Now, I want to launch this exe from a web application that is based on VB.net.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
6 Posts
How to launch an exe on the click of a button in asp.net application.
Dec 27, 2017 03:37 PM|vsinghal7|LINK
Hi,
I am using ActiveXObjects to launch an exe in my asp.net application, but that is not the most handsome solution that I came across as it is limited to be used in Internet Explorer and soon ActiveXObjects will be obsolete.
Is there a better way to achieve this(launching exe from an asp.net application) in asp.net application.
Thanks
Vinod
All-Star
48280 Points
17983 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 27, 2017 04:16 PM|PatriceSc|LINK
Hi,
Knowing your exact scenario could help. For example if you have to, you could associate a client side app with a particular file extension. What does this app ?
All-Star
57864 Points
15488 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 27, 2017 07:53 PM|bruce (sqlwork.com)|LINK
there is no better way. browser security has removed this feature. as you suggested this feature will also disappear in future versions of IE.
if you control the exe code, then a long term solution is to have the exe register a mime-type it responds to. the the web application could download a message of they mimic-type and the browser would open the application.
note: if this is an internal app, then you should write a launcher application, that registers a mimic-type that users install, and the payload could identify the exe to run.
Contributor
5290 Points
2307 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 28, 2017 06:51 AM|AngelinaJolie|LINK
Hi vsinghal,
Sir, I guess that you are looking for this, then it executes the .exe application;
Simple Working Example:
class Program { static void Main(string[] args) { Notepad np = new Notepad(); Thread th = new Thread(new ThreadStart(np.startNPprocess)); th.Start(); Console.WriteLine("press [enter] to exit"); Console.ReadLine(); } } public class Notepad { public void startNPprocess() { Process pr = new Process(); ProcessStartInfo prs = new ProcessStartInfo(); prs.FileName = @"notepad.exe"; pr.StartInfo = prs; pr.Start(); } }
With regards, Angelina Jolie
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
6 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 28, 2017 07:46 AM|vsinghal7|LINK
Hi Angelina,
Thanks for you response.
This approach suggested by you does not work if the web application is hosted on IIS because app pool does not allow exe to run on the server. I need to run my exe on the client side. So, I need some code which runs the exe on the client side.
Vinod
None
0 Points
6 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 28, 2017 07:48 AM|vsinghal7|LINK
Hi,
Thanks for you response.
The exe code is in my control as it is a WPF app which is created by my team only. I just want to launch that WPF app exe from a different web application.
The approach suggested by you looks interesting, I would appreciate if you can share a link where I can study in detail the approach suggested.
Thanks
Vinod
None
0 Points
6 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 28, 2017 07:51 AM|vsinghal7|LINK
Hi,
Thanks for you response.
Exact scenarios is, we have created a WPF app and created an exe of the same using ClickOnce. Now, I want to launch this exe from a web application that is based on VB.net.
Thanks
Vinod
Contributor
5290 Points
2307 Posts
Re: How to launch an exe on the click of a button in asp.net application.
Dec 28, 2017 09:44 AM|AngelinaJolie|LINK
Sir, the only one another way is to update Protocol, then it could open the client side exe application:
at view page:
Reference:
https://msdn.microsoft.com/en-us/library/aa767916.aspx#About_URLs_and_Name
https://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx
Bests,
Jolie
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.