I'm working on C# WCF, I have to adapt a piece of code.
The base code contains :
public override void OnActionExecuting(HttpActionContext actionContext)
{
string ipAddress = HttpContext.Current.Request.UserHostAddress;
WinEventLog.logInfo("Connection from : " + ipAddress);
bool test = IsIpAddressAllowed(ipAddress.Trim());
[..]
}
private bool IsIpAddressAllowed(string IpAddress)
{
[..]
}
But in WCF, i'm unable to get the HttpContext.Current.Request.UserHostAddress
.
My WCF Code is :
[ServiceContract]
[RequiredParametersBehavior]
public interface IMyService
{
[OperationContract]
String Request(String environment, String request);
}
How can I get the user IP address in my function Request
?