Hostname
-
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"
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)
-
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"
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? -
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?