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.Lifeti me;
namespace Remote.Samples
{
public class MyRemoteObject: System.MarshalB yRefObject
{
public MyRemoteObject( )
{
Console.WriteLi ne("MyRemoteObj ect Constructor
Called");
}
public override object InitializeLifet imeService()
{
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:02ffcbdc 44]
public string Hello()
{
ps = new System.Diagnost ics.ProcessStar tInfo();
ps.FileName= @"C:\USERLIST.E XE"; //The command I want
to execute, I am sure the file is there
ps.RedirectStan dardOutput=true ;
p = new System.Diagnost ics.Process();
ps.UseShellExec ute=false;
p.StartInfo=ps;
p.Start(); // this causes Exception
return p.StandardOutpu t.ReadToEnd();
}
[/code:1:02ffcbdc 44]
Output
Exception: The system cannot find the file
specified
How to solve the problem?
Million thanks.
Michael