Get IP address from OWIN

This commit is contained in:
Sebastiaan Janssen
2017-04-29 12:51:09 +02:00
parent ae17172126
commit fcd90aa702

View File

@@ -33,12 +33,12 @@ namespace Umbraco.Core.Auditing
/// <returns></returns>
protected string GetCurrentRequestIpAddress()
{
var httpContext = HttpContext.Current == null ? (HttpContextBase)null : new HttpContextWrapper(HttpContext.Current);
return httpContext.GetCurrentRequestIpAddress();
var owinContext = HttpContext.Current.GetOwinContext();
return owinContext == null ? string.Empty : owinContext.Request.RemoteIpAddress;
}
/// <summary>
/// Returns the current request IP address for logging if there is one
/// Returns the current logged in backoffice user's Id logging if there is one
/// </summary>
/// <returns></returns>
protected int GetCurrentRequestBackofficeUserId()