Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

client ip address

How to get client ip address in asp.net.

like image 567
andrew Sullivan Avatar asked Jun 09 '10 05:06

andrew Sullivan


People also ask

Does server know client IP address?

No it doesn't. It remains connected, and the response is sent back down the same connection. No need for the HTTP server to know the client's IP address.

Does client IP address change?

When a device is assigned a static IP address, the address does not change. Most devices use dynamic IP addresses, which are assigned by the network when they connect and change over time.


2 Answers

HttpRequest.UserHostAddress 

http://msdn.microsoft.com/en-us/library/system.web.httprequest.userhostaddress.aspx

like image 146
Raj Kaimal Avatar answered Sep 22 '22 00:09

Raj Kaimal


i used that in ASP.NET 3.5
string ip = Request.UserHostAddress();

like image 32
Govind Malviya Avatar answered Sep 19 '22 00:09

Govind Malviya