Coffeehouse Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

system() but for ASP

Back to Forum: Coffeehouse
  • User profile image


    php has a function called system where you can call system commands and executables, for example system('uptime')

    Is there something like that for ASP? I'd like to show the output of the 'uptime -a' on windows 2003 server in a webpage.

  • User profile image

    System.Diagnostics has process-handling classes that let you deal with outside executables.

  • User profile image

    That seems like an odd place for it.

  • User profile image

    Something like this is how you would use it in C# (implies ASP.NET, not plain ASP). You'll need to add using lines for System.Diagnostics and System.IO, too:

    Process proc = new Process();
    proc.StartInfo.FileName = "uptime.exe";
    proc.StartInfo.Arguments = "-a";
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.RedirectStandardOutput = true;


    StreamReader sw = proc.StandardOutput;
    string myString = sw.ReadToEnd();

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.