Hai all,
How to get the Public IP (183.82.1.30) address using asp.net, i get the ip address like 192.168.1.1 but i need network ip address please help how to find via code in asp.net
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
Keyur PatelRank #1,216 · 1.5K reputationPosted Jan 13, 2014, 11:35 PM EST
Please try following solution
1) You can open following link in your form or use the web client libraries to fetch http://whatismyip.org/.
2) You can use following code to get public IP
public void GetIP()
{
string IPAddr = string.Empty;
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
IPAddr = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
IPAddr = HttpContext.Current.Request.UserHostAddress;
}
uip.Text = "Your IP is: " + IPAddr;
}
3) http://www.codeproject.com/Questions/399318/How-to-Get-User-IP-address-using-csharp
Keyur PatelRank #1,216 · 1.5K reputationPosted Jan 13, 2014, 11:35 PM EST
Please try following solution
1) You can open following link in your form or use the web client libraries to fetch http://whatismyip.org/.
2) You can use following code to get public IP
2) http://www.codeproject.com/Questions/399318/How-to-Get-User-IP-address-using-csharp