public ActionResult GetCleintPCName(string sid) { string PC1 = System.Net.Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName.ToString(); string PC2 = System.Environment.MachineName; string pcname = PC1 + " ,1: " + PC2; string computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["REMOTE_HOST"]).HostName.ToString(); string IP = Request.UserHostName; IPAddress myIP = IPAddress.Parse(IP); IPHostEntry GetIPHost = Dns.GetHostEntry(myIP); List<string> compName = GetIPHost.HostName.ToString().Split('.').ToList(); string comname= compName.First(); pcname = pcname + " 2:" + computer_name + " 3:" + comname; return Json(new { pcName = pcname }, JsonRequestBehavior.AllowGet); }
HttpRequest request = base.Request; // Get UserHostAddress property. string address = Request.ServerVariables["REMOTE_USER"];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)