diff --git a/src/Microsoft.AspNetCore.Diagnostics.Abstractions/IExceptionHandlerPathFeature.cs b/src/Microsoft.AspNetCore.Diagnostics.Abstractions/IExceptionHandlerPathFeature.cs
new file mode 100644
index 0000000000..7de318da8c
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Diagnostics.Abstractions/IExceptionHandlerPathFeature.cs
@@ -0,0 +1,17 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.AspNetCore.Diagnostics
+{
+ ///
+ /// Represents an exception handler with the original path of the request.
+ ///
+ public interface IExceptionHandlerPathFeature : IExceptionHandlerFeature
+ {
+ ///
+ /// The portion of the request path that identifies the requested resource. The value
+ /// is un-escaped.
+ ///
+ string Path { get; }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerFeature.cs b/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerFeature.cs
index e4a9040c81..f01fb6a1ab 100644
--- a/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerFeature.cs
+++ b/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerFeature.cs
@@ -5,8 +5,10 @@ using System;
namespace Microsoft.AspNetCore.Diagnostics
{
- public class ExceptionHandlerFeature : IExceptionHandlerFeature
+ public class ExceptionHandlerFeature : IExceptionHandlerPathFeature
{
public Exception Error { get; set; }
+
+ public string Path { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerMiddleware.cs b/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerMiddleware.cs
index 11f370ad73..b7f81f00ba 100644
--- a/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerMiddleware.cs
+++ b/src/Microsoft.AspNetCore.Diagnostics/ExceptionHandler/ExceptionHandlerMiddleware.cs
@@ -22,8 +22,8 @@ namespace Microsoft.AspNetCore.Diagnostics
private readonly DiagnosticSource _diagnosticSource;
public ExceptionHandlerMiddleware(
- RequestDelegate next,
- ILoggerFactory loggerFactory,
+ RequestDelegate next,
+ ILoggerFactory loggerFactory,
IOptions options,
DiagnosticSource diagnosticSource)
{
@@ -65,8 +65,10 @@ namespace Microsoft.AspNetCore.Diagnostics
var exceptionHandlerFeature = new ExceptionHandlerFeature()
{
Error = ex,
+ Path = originalPath.Value,
};
context.Features.Set(exceptionHandlerFeature);
+ context.Features.Set(exceptionHandlerFeature);
context.Response.StatusCode = 500;
context.Response.OnStarting(_clearCacheHeadersDelegate, context.Response);