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.
Asked
Active
Viewed 1,187 times
1 Answers
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
-
Thanks for replay. but i want to get using c# its possible to get in c#? – sejal patel May 31 '13 at 05:54
-
1You mean Xamarin (former mono-touch)? – Ondrej Peterka May 31 '13 at 06:00
-
Not using former mono-touch,but i develop a ios web app in c# so i want to get local ip of ios device from where comes a request.So i want to do in c# asp.net – sejal patel May 31 '13 at 06:07