Don't call tostring twice

This commit is contained in:
Claus Vium 2020-09-02 12:49:48 +02:00
parent e337756428
commit bde8c00306
1 changed files with 3 additions and 2 deletions

View File

@ -28,9 +28,10 @@ namespace MediaBrowser.Common.Extensions
/// <returns>The remote caller IP address.</returns>
public static string RemoteIp(this HttpRequest request)
{
if (string.IsNullOrEmpty(request.HttpContext.Items["RemoteIp"].ToString()))
var cachedRemoteIp = request.HttpContext.Items["RemoteIp"].ToString();
if (string.IsNullOrEmpty(cachedRemoteIp))
{
return request.HttpContext.Items["RemoteIp"].ToString();
return cachedRemoteIp;
}
IPAddress ip;