Execute an External Application

.NET Best Practices

The new method of Executing an Application from ASP.NET

Date : 2006-02-16
You probably resigned yourself to executing processes with some semi-arcane shell command when .NET came along and made it easy. Here is a great way to execute a process with ASP.NET

  Dim Proc As New System.Diagnostics.Process
  Proc.StartInfo.CreateNoWindow = True
  Proc.StartInfo.UseShellExecute = True
  Proc.StartInfo.WorkingDirectory = "C:executable"
  Proc.StartInfo.FileName = "proggy.exe"
  Proc.StartInfo.Arguments = "args"

System.Diagnostics.Process has many other abilities as well. Post a comment to show how you've used it.

Comments :

Anonymous 2006-08-03 #35

I tried using this in VS 2003 and XP - I am testing with calc.exe. The calculator process appears in task manager, but there is no window visible and it does not show up under applications running in taskmanager. Can you offer suggestions on what I need to check or add? Thanks.

BeachBum 2006-08-04 #36

That's true, a process started with this method will be treated as a "service". In most environments this would result in the process running on the server not the client. With the process running on the server even if there were a visible window for the calculator the client and therefore the user would not be able to see it. In order to start a process client side you would probably be looking for a javascript solution which is fairly limited in what it can do for security reasons.

  • Search For Articles