1

Can i get a local ipaddress of ios device from asp.net? I want to get a ios device ip address and want to store into database.

1 Answers1

0

You can obtain the IP addresss using ifaddrs. Full example e.g. here: iPhone/iPad/OSX: How to get my IP address programmatically?

And than you can use web service (asmx or WCF) to send the IP address to your ASP.NET based service. An example e.g. here:

http://highoncoding.com/Articles/809_Consuming__NET_Web_Services_in_an_iOS_Application.aspx

UDPATE:

Based on your clarification, this is what you might need:

 Request.ServerVariables["REMOTE_ADDR"],   //the address, but if you are behind e.g. badly configured load balancer the IP will be not of the origin of the request
 Request.ServerVariables["HTTP_X_FORWARDED_FOR"] //if you are behind proxy or load balancer, this is where the original IP address should be
Community
  • 1
  • 1
Ondrej Peterka
  • 3,349
  • 4
  • 35
  • 49