简体   繁体   中英

How to call an exe file in button click from ASP.Net?

I have an exe file (Console Application). In my ASP.Net I have a page that has a button. On the button click. I wanna start the console application.

Here is my code :

ProcessStartInfo startinfo = new ProcessStartInfo();
            startinfo.FileName = @"C:\PushNotificationSampleConsoleVersion\PushNotificationSampleConsoleVersion\bin\Release\PushNotificationSampleConsoleVersion.exe";
            startinfo.CreateNoWindow = true;
            startinfo.UseShellExecute = true;
            Process myProcess = Process.Start(startinfo);
            myProcess.Start();

When I click the button. nothing happened. I do not see the command prompt window. However when I check my task manager. I see the process started.

Any issue with my code ?

Thanks.

To launch an exe from the webpage you should have to do something extra . As browser is not allow to directly look into your file system .This linq may help you . How to launch an EXE from Web page (asp.net)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM