title: how to get Current internet IP in ASP.NET MVC when working on localhost instead of 127.0.0.1
body: <p>I am working on a Asp.net MVC web Application.I want to detect the user IP address where he/she currently use my application , on the bases of this ip i want to set some functionalities in this web application. I am using= </p>
  
  <pre><code>if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
  {
      ipAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
  }
  else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
  {
      ipAddress = HttpContext.Current.Request.UserHostAddress;
  }
  </code></pre>
  
  <p>it will never goes to if part of the code because HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] it returned equal to null
  In else part it is always provide me IP of localhost ie. 127.0.0.1 ,  but i want to get my current internet IP. </p>