Getting the IP address of the client PC

G

Greg Smith

Is there a way to get the IP address of the person who is accessing your web
page?

Any help is greatly appreciated.
 
M

Mark Rae

Greg Smith said:
Is there a way to get the IP address of the person who is accessing your web
page?

Any help is greatly appreciated.

Investigate Request.ServerVariables - it's in the HttpContext.Current
namespace. Specifically, REMOTE_ADDR & REMOTE_HOST
 
C

Curt_C [MVP]

Request.ServerVariables should get you what you need.
Mind you if they are behind a NAT or IP Mask/Proxy you will get that IP.
 
K

Kevin Spencer

All of the solutions you've been presented with work. However, IP addresses
on the Internet change frequently as a rule. Don't expect each user to
return with the same IP address, unless you are working on a LAN.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

Jens Christian Mikkelsen

Eliyahu Goldin said:
Request.UserHostAddress

And in addition, Request.UserHostName will do a reverse DNS to get the name
of the client machine.

/Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top