2

In local host how to get the client IP to detect the their country name in asp.net mvc with C#. my code is

string ipAddress = Request.ServerVariables["REMOTE_ADDR"];
string ipAddress2 = Request.UserHostAddress;

this gives the ::1 so i need the public ip from user request

ekad
  • 14,436
  • 26
  • 44
  • 46
Krazy_Tech
  • 316
  • 3
  • 11
  • 1
    Possible duplicate of [How to get a user's client IP address in ASP.NET?](http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net). You can also check this one: [link](http://stackoverflow.com/questions/19285957/how-to-get-the-public-ip-address-of-a-user-in-c-sharp) – Simeon Vanov Jan 22 '16 at 08:24
  • You get ::1 because you should be on localhost – lyz Jan 22 '16 at 09:31
  • Can you tell me, how to get Http_accept value in asp.net-mvc5? – Khawaja Asim Apr 03 '17 at 20:00

0 Answers0