diff options
author | Brennan Conroy <brecon@microsoft.com> | 2022-08-10 21:02:08 +0300 |
---|---|---|
committer | Brennan Conroy <brecon@microsoft.com> | 2022-08-10 21:02:08 +0300 |
commit | aa2b0ced68f521415a2579457ffb3e3a4303d035 (patch) | |
tree | 0e89228d02172826a039745eebf31ac0c1fd2898 | |
parent | 1cf8acb6beeb7cf115a8501119e272350015ec59 (diff) |
small fixupbrecon/pathbase
-rw-r--r-- | src/Shared/Reroute.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Shared/Reroute.cs b/src/Shared/Reroute.cs index 806ff5e296..d44e103205 100644 --- a/src/Shared/Reroute.cs +++ b/src/Shared/Reroute.cs @@ -13,9 +13,9 @@ internal static class RerouteHelper internal static RequestDelegate Reroute(IApplicationBuilder app, object routeBuilder, RequestDelegate next) { - var builder = app.New(); - if (builder.Properties.TryGetValue(UseRoutingKey, out var useRouting) && useRouting is Func<IApplicationBuilder, IApplicationBuilder> useRoutingFunc) + if (app.Properties.TryGetValue(UseRoutingKey, out var useRouting) && useRouting is Func<IApplicationBuilder, IApplicationBuilder> useRoutingFunc) { + var builder = app.New(); // use the old routing pipeline if it exists so we preserve all the routes and matching logic // ((IApplicationBuilder)WebApplication).New() does not copy GlobalRouteBuilderKey automatically like it does for all other properties. builder.Properties[GlobalRouteBuilderKey] = routeBuilder; |