string ip = Request.UserHostName;
var hostName= GetLocalHostName(ip )
public string GetLocalHostName(string ip)
{
IPAddress ipadd = System.Net.IPAddress.Parse(ip);
IPHostEntry hostName = Dns.GetHostEntry(ipadd);
var list = hostName.HostName.ToString().Split('.').ToList();
var host = list.First();
return host;
}
var hostName= GetLocalHostName(ip )
public string GetLocalHostName(string ip)
{
IPAddress ipadd = System.Net.IPAddress.Parse(ip);
IPHostEntry hostName = Dns.GetHostEntry(ipadd);
var list = hostName.HostName.ToString().Split('.').ToList();
var host = list.First();
return host;
}
0 Comments