Thursday, 17 January 2013 13:54

how to get the host name and Ip address of your website

Written by 
Rate this item
(0 votes)
following method will return the host name/domain name -

private string CurrentDNSName
{
get
{
return base.Request.Url.Host.ToLower();
}
}

following method will return the IP address of your website-

private string CurrentServerIPAddress
{
get
{

return Dns.GetHostAddresses(this.CurrentDNSHame)[1].ToString();
}
}

Read 3086 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.