Files
Umbraco-CMS/src/Umbraco.Web/Net/AspNetIpResolver.cs
Bjarke Berg 2b8be2cf00 Netcore: Move files from Web/Routing to Abstractions/Routing (#7642)
* AB4951 - Move routing files to abstractions

* Changed UriUtility from static to instance

* Moved more files from Routing in web to Abstractions

* Moved UrlProvider to Abstractions

* Moved PublishedRequest to Abstractions
2020-02-17 12:07:51 +01:00

18 lines
485 B
C#

using System.Web;
using Umbraco.Core;
using Umbraco.Net;
namespace Umbraco.Web
{
internal class AspNetIpResolver : IIpResolver
{
public string GetCurrentRequestIpAddress()
{
var httpContext = HttpContext.Current is null ? null : new HttpContextWrapper(HttpContext.Current);
var ip = httpContext.GetCurrentRequestIpAddress();
if (ip.ToLowerInvariant().StartsWith("unknown")) ip = "";
return ip;
}
}
}