diff --git a/src/NLog.Web.AspNetCore/LayoutRenderers/AspNetTlsHandshakeLayoutRenderer.cs b/src/NLog.Web.AspNetCore/LayoutRenderers/AspNetTlsHandshakeLayoutRenderer.cs
index a04d73ce..65b723d4 100644
--- a/src/NLog.Web.AspNetCore/LayoutRenderers/AspNetTlsHandshakeLayoutRenderer.cs
+++ b/src/NLog.Web.AspNetCore/LayoutRenderers/AspNetTlsHandshakeLayoutRenderer.cs
@@ -1,14 +1,24 @@
-using NLog.LayoutRenderers;
+#if ASP_NET_CORE3
+using Microsoft.AspNetCore.Connections.Features;
+using NLog.Config;
+using NLog.LayoutRenderers;
+using NLog.Web.Enums;
using NLog.Web.Internal;
using System.Text;
namespace NLog.Web.LayoutRenderers
{
///
- /// ASP.NET TSL Handshake
+ /// ASP.NET TLS Handshake
///
///
- /// ${aspnet-tls-handshake}
+ /// ${aspnet-tls-handshake:Property=CipherAlgorithm}
+ /// ${aspnet-tls-handshake:Property=CipherStrength}
+ /// ${aspnet-tls-handshake:Property=HashAlgorithm}
+ /// ${aspnet-tls-handshake:Property=HashStrength}
+ /// ${aspnet-tls-handshake:Property=KeyExchangeAlgorithm}
+ /// ${aspnet-tls-handshake:Property=KeyExchangeStrength}
+ /// ${aspnet-tls-handshake:Property=Protocol}
///
[LayoutRenderer("aspnet-tls-handshake")]
public class AspNetTlsHandshakeLayoutRenderer : AspNetLayoutRendererBase
@@ -17,17 +27,22 @@ public class AspNetTlsHandshakeLayoutRenderer : AspNetLayoutRendererBase
/// Specifies which of the 7 properties of ITlsHandshakeFeature to emit
/// Defaults to the protocol
///
+ [DefaultParameter]
public TlsHandshakeProperty Property { get; set; } = TlsHandshakeProperty.Protocol;
///
- /// Render TLS Handshake Cipher Algorithm
+ /// Render TLS Handshake Information
///
///
///
protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
{
-#if ASP_NET_CORE3
- var tlsHandshake = HttpContextAccessor.HttpContext.TryGetTlsHandshake();
+ var features = HttpContextAccessor.HttpContext.TryGetFeatureCollection();
+ if(features == null)
+ {
+ return;
+ }
+ var tlsHandshake = features.Get();
if (tlsHandshake == null)
{
return;
@@ -57,7 +72,8 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
builder.Append(tlsHandshake.Protocol);
break;
}
-#endif
+
}
}
}
+#endif
\ No newline at end of file