• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

How to call a remote console application from an ASP.NET C# web application?

Hello folks,

The following code snippet causes an exception "Logon failure: unknown user name or bad password".

     Process p = new Process();
     p.StartInfo.UseShellExecute = false; // only executables; no docs like Run.
     p.StartInfo.RedirectStandardOutput = true;
     p.StartInfo.Arguments = @"www.yahoo.com";
     p.StartInfo.FileName = @"\\my-remote-machine-name\C$\WINDOWS\SYSTEM32\ping.exe";
     //p.StartInfo.FileName = "C:\\WINNT\\SYSTEM32\\ping.exe";
     p.StartInfo.CreateNoWindow = true;
     string output = p.StandardOutput.ReadToEnd();

To use shared folders in that remote machine, I supply my credentials.
How do I pass that user name and password for the above code to work?

Your help will be highly appreciated.

Thank you,
  • 2
1 Solution
parvindergAuthor Commented:
Thank you, that worked.

I added ASPNET as username and a cleartext password in machine.config.
Also I created ASPNET user on the remote machine.

I'm not sure if cleartext password in machine.config is safe.
And what privilages should the ASPNET account on the remote machine have?

I am afraid that I can't really help you with these supplemental questions as I am just learning .Net now. Perhaps you might ask these in the ASP.Net topic area?


Perhaps someone there can help.

Good luck,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now