Click here to Skip to main content
16,016,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to know that how to fetch the IP ADDRESS..
from where user logged in.
And i wants to save it in database.
Posted
Updated 19-Mar-12 4:42am
v2

If your application is accessible over the internet then getting the IP address may not make any sense but you can try the following:

C#
HttpContext.Current.Request.UserHostAddress; 
or 
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
 
Share this answer
 
try this
IPHostEntry GetIPHost = Dns.GetHostEntry(Request.UserHostName);
if (GetIPHost != null)
    ip = GetIPHost.AddressList[0].ToString();


and also refere

http://alperguc.blogspot.in/2008/11/c-how-to-get-computer-ip-address.html[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900