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. Name of local machine

Name of local machine

Scheduled Pinned Locked Moved C#
questioncsharp
6 Posts 5 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.
  • A Offline
    A Offline
    Andy M
    wrote on last edited by
    #1

    How do I get the name of the local machine from a C# application?

    D K L 3 Replies Last reply
    0
    • A Andy M

      How do I get the name of the local machine from a C# application?

      D Offline
      D Offline
      Dan_P
      wrote on last edited by
      #2

      Try: System.Net.Dns.GetHostName();

      C A 2 Replies Last reply
      0
      • D Dan_P

        Try: System.Net.Dns.GetHostName();

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        You beat me too it :-D I was just getting the reference from MSDN to provide a link. Oh well.... Here is a link anyway: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemNetDnsClassGetHostNameTopic.asp[^]


        My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

        1 Reply Last reply
        0
        • A Andy M

          How do I get the name of the local machine from a C# application?

          K Offline
          K Offline
          Kodanda Pani
          wrote on last edited by
          #4

          Hi, Guess the following code will help you. string hostname = ""; hostname = Dns.GetHostName(); MessageBox.Show(hostname.ToString()); Thanks and Regards SGS

          1 Reply Last reply
          0
          • A Andy M

            How do I get the name of the local machine from a C# application?

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            Environment.MachineName xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

            1 Reply Last reply
            0
            • D Dan_P

              Try: System.Net.Dns.GetHostName();

              A Offline
              A Offline
              Andy M
              wrote on last edited by
              #6

              Thanks, that worked great.

              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