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. Web Development
  3. ASP.NET
  4. Hostname

Hostname

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netsysadmin
4 Posts 4 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.
  • D Offline
    D Offline
    deanoA
    wrote on last edited by
    #1

    How do I get the hostname of the server from where the ASP.net application is running? Is that possible? "To teach is to learn twice"

    B M 2 Replies Last reply
    0
    • D deanoA

      How do I get the hostname of the server from where the ASP.net application is running? Is that possible? "To teach is to learn twice"

      B Offline
      B Offline
      Blake Coverett
      wrote on last edited by
      #2

      That depends what you really want - after all, machines don't just have one name. Most like you want the value of the property: System.Web.HttpContext.Current.Request.Url.Host as that's the hostname that's part of the request you are currently servicing. But it's plausible you want string returned by: System.Net.Dns.GetHostName() Which is the primary name of the machine you are hosted on. -- -Blake (com/bcdev/blake)

      1 Reply Last reply
      0
      • D deanoA

        How do I get the hostname of the server from where the ASP.net application is running? Is that possible? "To teach is to learn twice"

        M Offline
        M Offline
        Mike Ellison
        wrote on last edited by
        #3

        How about through the MachineName property of the HttpServerUtility class? You can call it from an .aspx page as Page.Server.MachineName. Of course, this implies you can create the .aspx page on the server.... are you looking to get the hostname of a server for someone else's Asp.net app?

        L 1 Reply Last reply
        0
        • M Mike Ellison

          How about through the MachineName property of the HttpServerUtility class? You can call it from an .aspx page as Page.Server.MachineName. Of course, this implies you can create the .aspx page on the server.... are you looking to get the hostname of a server for someone else's Asp.net app?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi! Thanks for the answer. Its actually for our app here. Were using two servers. It's just for testing purposes. :) ---daljv---- I'm having problems logging in! :confused:

          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