code_junkie

Redialing a PPPOE connection programatically

Nov 12th, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. rasdial connectionname
  2.  
  3. public static int OpenConnection(string connectionName, int Timeout) {
  4. int ExitCode;
  5. ProcessStartInfo ProcessInfo;
  6. Process Process;
  7.  
  8. ProcessInfo = new ProcessStartInfo("cmd.exe", "/C rasdial " + connectionName);
  9. ProcessInfo.CreateNoWindow = true;
  10. ProcessInfo.UseShellExecute = false;
  11. Process = Process.Start(ProcessInfo);
  12. Process.WaitForExit(Timeout);
  13. ExitCode = Process.ExitCode;
  14. Process.Close();
  15.  
  16. return ExitCode;
  17. }
  18.  
  19. rasdial "connection name" /d
Add Comment
Please, Sign In to add comment