Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Client server connection

Client server connection

Scheduled Pinned Locked Moved C#
questionsysadminwindows-admin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yogesh_softworld123
    wrote on last edited by
    #1

    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

    Y 1 Reply Last reply
    0
    • Y yogesh_softworld123

      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

      Y Offline
      Y Offline
      yogesh_softworld123
      wrote on last edited by
      #2

      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

      K 1 Reply Last reply
      0
      • Y yogesh_softworld123

        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

        K Offline
        K Offline
        KornZhang
        wrote on last edited by
        #3

        helo yogesh_softworld123 I can't find ConnectionOptions's definition, what's its Namespace ? thanks a lot~ :laugh:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups