I have tried the Request.UserHostAddress;
but API controller doesn't have UserHostAddress inside Request.
IP = ((HttpContextBase)request.Properties["MS_HttpContext"]).Request.UserHostAddress;
I am using the following code and it work for me....
string ipAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With