Monday, December 05, 2005
How to call External Application through ASP.NET
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());
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());
Upload a file to a virtual directory using WebClient class is asp.net
string uri=@"http://laptop/nmasp/SOMEPAGE.aspx";
string FileName=@"E:\nmasp\WebClient\Doc\Eula.RTF";
WebClient wc=new WebClient();
wc.Credentials =System.Net.CredentialCache.DefaultCredentials;
byte[] res=wc.UploadFile(uri,"post",FileName);
Response.Write(res.ToString());