I have a program (I created) and I want to start it on the server when the webpage loads.
Here is the code I have
public partial class _Default : System.Web.UI.Page
{
Process app = new Process();
protected void Page_Load(object sender, EventArgs e)
{
app.StartInfo.FileName = @"D:/Path to /My/Program to be run.exe";
app.Start();
}
}
Right now the application is 'run' however it crashes instantly. If I just run the application (by double clicking the exe) it runs and everything is fine.
anyone see if i'm missing something here?
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites. It allows you to use a full featured programming language such as C# or VB.NET to build web applications easily.
Run the ASP.NET Core Application: To run this web application, click on IIS Express or press F5 (with Debug) or Ctrl + F5 (without Debug).
You could use ProcessStartInfo.
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"D:/Path to /My/Program to be run.exe";
psi.WorkingDirectory = IO.Path.GetDirectoryName(psi.FileName);
Diagnostics.Process.Start(psi);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With