How to get ip address
How to get Static IP Address Of Client Ip And Other Information in asp.net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Hemant KumarRank #1,202 · 1.5K reputationPosted Apr 24, 2014, 11:28 PM EDT
protected void GetUser_IP()
{
string VisitorsIPAddr = string.Empty;
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
VisitorsIPAddr = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
VisitorsIPAddr = HttpContext.Current.Request.UserHostAddress;
}
uip.Text = "Your IP is: " + VisitorsIPAddr;
}
Sanjay SinghRank #779 · 2.9K reputationPosted Apr 25, 2014, 1:27 AM EDT
please visit
http://www.dotnetperls.com/ip
Munesh SharmaRank #174 · 13.9K reputationPosted Apr 25, 2014, 2:47 AM EDT
http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net
and
http://stackoverflow.com/questions/2577496/how-can-i-get-the-clients-ip-address-in-asp-net-mvc