2013-05-31 90 views

回答

0

您可以使用ifaddrs獲取IP地址。完整的例子這裏:iPhone/iPad/OSX: How to get my IP address programmatically?

而且你可以使用web服務(asmx或WCF)將IP地址發送到基於ASP.NET的服務。例如,在這裏:

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

UDPATE:

根據您的澄清,這是你可能需要的東西:

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 
+0

感謝重播。但我想獲得使用C#可能獲得在C#? –

+1

你的意思是Xamarin(以前的單觸式)? –

+0

不使用以前的單點觸摸,但我在C#中開發一個IOS Web應用程序,所以我想從哪裏來請求本地ip的IOS設備。所以我想在C#asp.net –