C#宽带拨号

class AutoDialer
{
public void Connect(string connectionName, string user, string pass)
{
      string arg = string.Format("rasdial \"{0}\" {1} {2}", connectionName, user, pass);
      string msg = InvokeCmd(arg);
}
public bool Disconnect(string connectionName)
{
      string arg = string.Format("rasdial \"{0}\" /disconnect", connectionName);
      string msg = InvokeCmd(arg);
      if (msg.Contains("命令已完成"))
      {
            return true;
      }
      else
      {
            return false;
      }
}
private static string InvokeCmd(string cmdArgs)
{
      Process p = new Process();
      p.StartInfo.FileName = "cmd.exe";
      p.StartInfo.UseShellExecute = false;
      p.StartInfo.RedirectStandardInput = true;
      p.StartInfo.RedirectStandardOutput = true;
      p.StartInfo.RedirectStandardError = true;
      p.StartInfo.CreateNoWindow = true;
      p.Start();
      p.StandardInput.WriteLine(cmdArgs);
      p.StandardInput.WriteLine("exit");
      return p.StandardOutput.ReadToEnd();
}
}