Click here to Skip to main content
14,268,557 members
Rate this:
Please Sign up or sign in to vote.
See more:
i am trying to run the exe file in asp.net web application below is the code

Process p = new Process();
p.StartInfo.FileName = @"E:\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe";
p.StartInfo.Arguments = "'"+ TDcon + "' '" + req + "' '" + DBName + "'";
p.Start();

but i am not getting expected result.
what will be the order in args for the passed above arguments?

What I have tried:

@"E:\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe";
p.StartInfo.Arguments = "'"+ TDcon + "' '" + req + "' '" + DBName + "'";
Posted
Updated 14-Aug-19 11:23am
Comments
ZurdoDev 14-Aug-19 13:39pm
   
What is the error message? What does happen? If you are running this code via a web page then the path must exist on the web server and the web app must have the proper permissions (which it won't by default.)
syed muzakir 14-Aug-19 13:47pm
   
no error it just passes, expected result is i should receive a mail which is not happening
ZurdoDev 14-Aug-19 14:01pm
   
You'll have to debug it. Like I said, make sure the path on the server exists and that permissions are correct.

Log into the server and run the command line directly and see what happens.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

First, your ASP.NET code runs entirely on the server, never on the client.

If you're expecting the client to be running the console app, that's never going to happen. Security prevents you from doing that.

Now, if the server is supposed to be running the console app, then the ASPNET account that your code is running under (by default) will NOT have access to anything outside of the folder your web app is running from. This means that the E: drive is not accessible to your code.

If the E: drive is mapped to a network share, it gets even worse. The ASPNET account won't have any access to network shares at all, and therefore, neither will your code.

You can get any unhandled exceptions your code is throwing from EventVwr in the Application event log.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100