Hi,
I am learning .NET remoting and following the tutorial
http://www.csharphelp.com/archives2/archive460.html
Everything works fine.
Now I want to modify it a bit for my personal use but I failed :o
Original file
using System;
using System.Runtime.Remoting.Lifetime;
namespace Remote.Samples
{
public class MyRemoteObject:System.MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine("MyRemoteObject Constructor
Called");
}
public override object InitializeLifetimeService()
{
return null;
}
public string Hello()
{
return "Hello, Welcome to .Net Remoting !";
}
}
}
I want to modify the Hello method so that it will execute the command
I want
[code:1:02ffcbdc44]
public string Hello()
{
ps = new System.Diagnostics.ProcessStartInfo();
ps.FileName= @"C:\USERLIST.EXE"; //The command I want
to execute, I am sure the file is there
ps.RedirectStandardOutput=true;
p = new System.Diagnostics.Process();
ps.UseShellExecute=false;
p.StartInfo=ps;
p.Start(); // this causes Exception
return p.StandardOutput.ReadToEnd();
}
[/code:1:02ffcbdc44]
Output
Exception: The system cannot find the file
specified
How to solve the problem?
Million thanks.
Michael