I have application want to get user machine name, here I can retrieve and it works fine in localhost.
string clientPCName;
string[] computer_name = System.N
As @blowdark wrote it's impossible actually to get client machine name and host name is not client machine name. Let's look at what from request you can have?
That's all. IP address is an IP which is given by your Internet provider, and host name is name of some provider machine which Internet traffic passes through. You even cannot get in simple way user machine local IP address in Internet provider network.
If your application has load balancer or proxy then you need to read HTTP_X_FORWARDED_FOR header (by default) to get request client IP. But it's provider IP again.
So, from request IP you cannot get real client machine name in general. In HTTP headers browsers also don't pass machine name. Perhaps with some kind of hacks you can get machine name asking provider server, but that's out of scope.