lundi 1 août 2016

How to get Client's computer name from WCF asmx C#?

How to get Client's computer name from WCF asmx C#?

I have tried this way but it doesn't work at all.

1.string[] computer_name = System.Net.Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' }); logData.ComputerName = computer_name[0].ToString();

*****This is a best solution that i was thinking of but it doesn't work ... okay the resault is return Client's computer name but someting return Computer name A and sometime its Computer Name B

2.System.Environment.MachineName

*****The resualt is Compeuter name from WCF not Client.

3.System.Net.Dns.GetHostByName("LocalHost").HostName.

*****The resualt as 1 but return Empty sometime

4.OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name

*****Return Null.

5.Request.ServerVariables["remote_addr"],Request.ServerVariables["remote_host"],Request.ServerVariables["remote_user"]

*****Return IP,IP and Client's user login

please help me....Thanks guys.




Aucun commentaire:

Enregistrer un commentaire