diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs index 2b3b8eae..b2bfb266 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs @@ -3,6 +3,7 @@ #if !NETSTANDARD_1plus using NLog.Common; using System.Web; +using System.Web.Routing; #else using Microsoft.AspNetCore.Http; #endif @@ -57,12 +58,18 @@ public class AspNetRequestValueLayoutRenderer : AspNetLayoutRendererBase /// public string Cookie { get; set; } +#if !NETSTANDARD_1plus + + //missing in .NET Core (RC2) + /// /// Gets or sets the ServerVariables item to be rendered. /// /// public string ServerVariable { get; set; } +#endif + /// /// Gets or sets the Headers item to be rendered. /// @@ -109,15 +116,14 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) #endif } +#if !NETSTANDARD_1plus else if (this.ServerVariable != null) { -#if !NETSTANDARD_1plus + builder.Append(httpRequest.ServerVariables[this.ServerVariable]); -#else - throw new NotSupportedException(); -#endif } +#endif else if (this.Header != null) { string header = httpRequest.Headers[this.Header];