How to get IP address of each terminal (which is running the ASP.NET application) instead of the hosting machine's IP address?

If my ASP.NET application runs on an IIS server, and there is a group of severl WYSE thin client terminals which runs this application (i think it has their own IP address), i found if I used the traditional way to get IP address (the code listed at the end), the IP address or hostname shown on these terminals are the same: hosting machine's IP address or hostname. Apparently, it's not what I want: each terminal shows their own IP address or hostname when they run this application. Is there any way to show their own IP address in their browser? Any comment is welcome. Below is my code which works well to get the first byte of the IP address of the hosting machine, thanks a lot!

IPHostEntry HostInfo = Dns.GetHostByName("");  
IPAddress [] IpAddr = HostInfo.AddressList;      //IP string
byte [] IpBytes = IpAddr[0].GetAddressBytes();      //four bytes
string FirstByte = IpBytes[0].ToString();
heyday2004Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

surajgupthaCommented:
Request.ServerVariables[28] should give the Hosting ip Address

Request.ServerVariables[32] should give the ip address of the machine that runs it
Request.ServerVariables[33] should give the ip address of the machine that runs it

Please let me know if it works
0
mmarinovCommented:
Hi heyday2004,

you can use Request.UserHostAddress to get IP address of the computer that request the application and
Request.UserHostName to get the DNS name

Regards!
B..M
mmarinov
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
heyday2004Author Commented:
Thanks a lot for the answer. I tried Request.ServerVariables[32], Request.UserHostName (supposed to print out a user machine name instead of IP address), but both printed "127.0.0.1",  I know this local host IP address, i.e.  when a machine sends an IP packet to it ( 127.0.0.1) , it is sending to itself. Of course, what I want is not that, i want the client machine's user name. Any help is appreciated! Thanks a lot!
0
heyday2004Author Commented:
I got the hostname successfully finally. The code is below:
string client = Request.UserHostName;
return (System.Net.Dns.GetHostByAddress(client)).HostName;

So now, i just wonder why  Request.UserHostName returns IP address? thanks a lot.

      
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.