public class IpController : ApiController { public string GetIp() { return GetClientIp(); } private string GetClientIp(HttpRequestMessage request = null) { request = request ?? Request; if (request.Properties.ContainsKey("MS_HttpContext")) { return ((HttpContextWrapper)request.Properties["MS_HttpContext"]).Request.UserHostAddress; } else if (HttpContext.Current != null) { return HttpContext.Current.Request.UserHostAddress; } else { return null; } } }
Now,i want to add this ip address(entry or ip address of current requesting user) in iis. I am working with web api and iis version7. How can i get this ip address and add it to iis programatically in my service class. Thank you.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)