.NETJiNi@jigneshdesai.com  
  Home |  .NET<1.0 to 3.5> Forums Blogs |  Other Technologies Skip Navigation Links  | Quiz Contest   dotnetJini Training |   Software Development 
 
How to call External Application through ASP.NET
Saturday, 03-December-2005

Well at first attempt it will sound like, what ? ASP.NET application is processed on server side, how will you get the output?. Well remember its not always that you want to run a visual application. it can be a background application like some utility. For eg: After uploading a file you want to zip it and store it on your disk. Infact any console output emitted by your application can be read and displayed back into webbrowser

You can use your System.Diagnostics namespace to interact with system processes. Here is a small tip.

 

string file = Server.MapPath(@"MyApp.exe");
ProcessStartInfo info = new ProcessStartInfo(file, "otherargs");
info.RedirectStandardOutput = true;
info.UseShellExecute = false;
Process p = Process.Start(info);
p.Start(); 
// Send whatever was returned through the output to the client.
Response.Write(p.StandardOutput.ReadToEnd());

Note that the ASP.NET worker process needs to have permissions to access the external application. The most simple way to ensure this is to place it under the bin folder. 

Readers: What do you think? Can you execute a external application using JavaScript ?

From 10 million light years zoom in to microscopic world @ 100 attometers
Wednesday, 14-December-2005
The DQ-IDC India: SALARY SURVEY '05
Wednesday, 28-December-2005








   







Chat Online
 








Add URL | About ME Privacy Policy | Legal Disclaimer

Copyright (C) 2004 -2008 JigneshDesai.com. All rights reserved