You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
When adding a middleware mapping with IApplicationBuilder.Map(), the map path is reflected in HttpContext.Request.PathBase. If the application experiences an unhandled exception, and the IApplicationBuilder isn't setup with an exception handler(i.e. UseDeveloperExceptionPage()) the PathBase will be appended to.
So if my map is "/v1", after an unhandled exception the HttpContext.Request.PathBase will be "/v1/v1" Each unhandled exception will append the mapping.
This is a new ASP.NET 5 Web application template that I've pared down. The important parts are in the Startup.cs. In Configure I've added a mapping with the path /v1. In ConfigureSub I've commented out the default error handling.
If you go to localhost/v1 you'll see the pathbase displayed. If you then hit localhost/v1/home/error, it will throw an exception. If you then refresh localhost/v1 you'll see it repeated. I actually saw different results depending on if you're running it in IIS Express or Kestrel. In Kestrel the duplicated pathBase will always display, in IIS Express if you refresh localhost/v1 you'll see it alternate back and forth.
The text was updated successfully, but these errors were encountered:
When adding a middleware mapping with IApplicationBuilder.Map(), the map path is reflected in HttpContext.Request.PathBase. If the application experiences an unhandled exception, and the IApplicationBuilder isn't setup with an exception handler(i.e. UseDeveloperExceptionPage()) the PathBase will be appended to.
So if my map is "/v1", after an unhandled exception the HttpContext.Request.PathBase will be "/v1/v1" Each unhandled exception will append the mapping.
I've set up a simple sample in a github repo here. https://github.com/AlexAlappsis/AspNetMappingError.
This is a new ASP.NET 5 Web application template that I've pared down. The important parts are in the Startup.cs. In Configure I've added a mapping with the path /v1. In ConfigureSub I've commented out the default error handling.
If you go to localhost/v1 you'll see the pathbase displayed. If you then hit localhost/v1/home/error, it will throw an exception. If you then refresh localhost/v1 you'll see it repeated. I actually saw different results depending on if you're running it in IIS Express or Kestrel. In Kestrel the duplicated pathBase will always display, in IIS Express if you refresh localhost/v1 you'll see it alternate back and forth.
The text was updated successfully, but these errors were encountered: