How to get ip address
How to get Static IP Address Of Client Ip And Other Information in asp.net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Munesh SharmaPosted Apr 25, 2014, 6:47 AM
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
Sanjay SinghPosted Apr 25, 2014, 5:27 AM
please visit
http://www.dotnetperls.com/ip
Hemant KumarPosted Apr 25, 2014, 3:28 AM
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;
}