Client server connection
-
Hi, I am developing program to connect to the windows server 2003. i want to copy some folders from server PC to client PC through my program. if i do this without program then windows pops up for username and password to connect to the server. But in my program how can i handle pop up or how can i connect to the server? Thanks for reply.
yogesh
-
Hi, I am developing program to connect to the windows server 2003. i want to copy some folders from server PC to client PC through my program. if i do this without program then windows pops up for username and password to connect to the server. But in my program how can i handle pop up or how can i connect to the server? Thanks for reply.
yogesh
public string RemoteConnection(string targethost, string targetusername, string targetpassword) { StringBuilder result = new StringBuilder(); try { ConnectionOptions Conn = new ConnectionOptions(); if (targethost != Environment.MachineName) //WMI errors if creds given for localhost { Conn.Username = targetusername; //can be null Conn.Password = targetpassword; //can be null } ManagementScope scope = new ManagementScope(targethost , Conn); scope.Connect(); return result.ToString(); } catch { return "fail"; } }
yogesh
-
public string RemoteConnection(string targethost, string targetusername, string targetpassword) { StringBuilder result = new StringBuilder(); try { ConnectionOptions Conn = new ConnectionOptions(); if (targethost != Environment.MachineName) //WMI errors if creds given for localhost { Conn.Username = targetusername; //can be null Conn.Password = targetpassword; //can be null } ManagementScope scope = new ManagementScope(targethost , Conn); scope.Connect(); return result.ToString(); } catch { return "fail"; } }
yogesh