From 84e4a1055b4dabf9924d49dbf96d1b5af6545d34 Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Wed, 8 Feb 2023 17:06:46 -0800 Subject: [PATCH 1/6] Add HttpRequest.FilePath and HttpRequest.PathInfo --- .../Generated/Ref.Standard.cs | 2 + .../HttpRequest.cs | 60 +++++++++++++++++++ .../HttpRequestTests.cs | 27 +++++++++ 3 files changed, 89 insertions(+) diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs index 2363bc54d..55b99e3cd 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Generated/Ref.Standard.cs @@ -161,6 +161,7 @@ internal HttpRequest() { } public int ContentLength { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string ContentType { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} set { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Web.HttpCookieCollection Cookies { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } + public string FilePath { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Web.HttpFileCollection Files { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Collections.Specialized.NameValueCollection Form { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Collections.Specialized.NameValueCollection Headers { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } @@ -173,6 +174,7 @@ internal HttpRequest() { } public System.Security.Principal.IIdentity LogonUserIdentity { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Collections.Specialized.NameValueCollection Params { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string Path { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } + public string PathInfo { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Collections.Specialized.NameValueCollection QueryString { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public string RawUrl { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } public System.Web.ReadEntityBodyMode ReadEntityBodyMode { get { throw new System.PlatformNotSupportedException("Only supported when running on ASP.NET Core or System.Web");} } diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs index 6d3219608..7854110dd 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs @@ -10,12 +10,15 @@ using System.Security.Principal; using System.Text; using System.Web.Configuration; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Headers; +using Microsoft.AspNetCore.Mvc.TagHelpers; using Microsoft.AspNetCore.SystemWebAdapters; using Microsoft.AspNetCore.SystemWebAdapters.Internal; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; namespace System.Web @@ -50,6 +53,24 @@ internal HttpRequest(HttpRequestCore request) public string? Path => _request.Path.Value; + public string? PathInfo + { + get + { + GetFileInfoPath(out _, out var pathInfo); + return pathInfo.ToString(); + } + } + + public string? FilePath + { + get + { + GetFileInfoPath(out var filePath, out _); + return filePath.ToString(); + } + } + public NameValueCollection Headers => _headers ??= _request.Headers.ToNameValueCollection(); public Uri Url => new(_request.GetEncodedUrl()); @@ -311,5 +332,44 @@ public int Compare(StringWithQualityHeaderValue? x, StringWithQualityHeaderValue return yValue.CompareTo(xValue); } } + + /// + /// Gets the section of a path that could be interpreted as a file path and the subsequent path. + /// + /// For example: + /// + /// Path: /path/file.txt/subpath + /// FilePath: /path/file.txt + /// PathInfo: /subpath + /// + /// + /// + private void GetFileInfoPath(out StringSegment filePath, out StringSegment pathInfo) + { + var path = new StringSegment(Path); + var extensionIndex = path.IndexOf('.'); + + // If no extension, just return the path + if (extensionIndex == -1) + { + filePath = path; + pathInfo = string.Empty; + return; + } + + var endIndex = path.IndexOf('/', extensionIndex, path.Length - extensionIndex); + + // If no filepath, just return the path + if (endIndex == -1) + { + filePath = path; + pathInfo = string.Empty; + } + else + { + filePath = path.Subsegment(0, endIndex); + pathInfo = path.Subsegment(endIndex); + } + } } } diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs index 02479d6cd..91fa618ef 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs @@ -58,6 +58,33 @@ public void Path() Assert.Equal(path.Value, result); } + [Theory] + [InlineData("/", "/", "")] + [InlineData("/path", "/path", "")] + [InlineData("/path/", "/path/", "")] + [InlineData("/some/path/", "/some/path/", "")] + [InlineData("/some/path", "/some/path", "")] + [InlineData("/some/path.txt", "/some/path.txt", "")] + [InlineData("/some/path.txt/", "/some/path.txt", "/")] + [InlineData("/some/path.txt/after", "/some/path.txt", "/after")] + [InlineData("/some/path.txt/after/", "/some/path.txt", "/after/")] + public void FilePath(string path, string expectedFilePath, string expectedPathInfo) + { + // Arrange + var coreRequest = new Mock(); + coreRequest.Setup(c => c.Path).Returns(path); + + var request = new HttpRequest(coreRequest.Object); + + // Act + var filePath = request.FilePath; + var pathInfo = request.PathInfo; + + // Assert + Assert.Equal(expectedFilePath, filePath); + Assert.Equal(expectedPathInfo, pathInfo); + } + [Fact] public void Url() { From a785993f1700898ca39afd10fce41b4af5d1c622 Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Tue, 7 Feb 2023 10:59:58 -0800 Subject: [PATCH 2/6] REMOVE: use 7.0.102 SDK --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index d8608b9ed..704df54fd 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.100-alpha.1.23061.8" + "version": "7.0.102" }, "tools": { - "dotnet": "8.0.100-alpha.1.23061.8", + "dotnet": "7.0.102", "runtimes": { "dotnet": [ "6.0.4" From 5ceec6dccac44762b6575af285576afb2ece462f Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Thu, 9 Feb 2023 10:47:27 -0800 Subject: [PATCH 3/6] wip --- .../SystemWebAdapterOptions.cs | 12 ++++++++++++ .../SystemWebAdaptersExtensions.cs | 17 +++++++++++++++++ .../HttpRequest.cs | 2 +- .../HttpRequestTests.cs | 3 +++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs new file mode 100644 index 000000000..f3cf8af8c --- /dev/null +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using Microsoft.Extensions.Primitives; + +namespace Microsoft.AspNetCore.SystemWebAdapters; + +public class SystemWebAdapterOptions +{ + public ICollection Extensions { get; } = new HashSet(StringSegmentComparer.OrdinalIgnoreCase); +} diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs index 7b564e897..8df27cf78 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs @@ -13,6 +13,22 @@ namespace Microsoft.Extensions.DependencyInjection; public static class SystemWebAdaptersExtensions { + public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollection services, Action configure) + { + services.Configure(configure); + return services.AddSystemWebAdapters(); + } + + private static ISystemWebAdapterBuilder AddDefaultExtensions(this ISystemWebAdapterBuilder builder) + { + builder.Services.Configure(option => + { + option.Extensions.Add(".aspx"); + }); + + return builder; + } + public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollection services) { services.AddHttpContextAccessor(); @@ -22,6 +38,7 @@ public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollect services.AddTransient(); return new SystemWebAdapterBuilder(services) + .AddDefaultExtensions() .AddMvc(); } diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs index 7854110dd..da38fc594 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs @@ -347,7 +347,7 @@ public int Compare(StringWithQualityHeaderValue? x, StringWithQualityHeaderValue private void GetFileInfoPath(out StringSegment filePath, out StringSegment pathInfo) { var path = new StringSegment(Path); - var extensionIndex = path.IndexOf('.'); + var extensionIndex = path.LastIndexOf('.'); // If no extension, just return the path if (extensionIndex == -1) diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs index 91fa618ef..190263c66 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs @@ -68,6 +68,9 @@ public void Path() [InlineData("/some/path.txt/", "/some/path.txt", "/")] [InlineData("/some/path.txt/after", "/some/path.txt", "/after")] [InlineData("/some/path.txt/after/", "/some/path.txt", "/after/")] + [InlineData("/some/path.not/file.txt", "/some/path.not/file.txt", "")] + [InlineData("/some/path.not/file.txt/", "/some/path.not/file.txt", "/")] + [InlineData("/some/path.not/file.txt/subpath", "/some/path.not/file.txt", "/subpath")] public void FilePath(string path, string expectedFilePath, string expectedPathInfo) { // Arrange From 3212d7a83470f5c6406766fc46d217cd9b906c36 Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Thu, 9 Feb 2023 14:52:25 -0800 Subject: [PATCH 4/6] add feature --- .../Adapters/IPathInfoFeature.cs | 13 +++ .../HttpRequest.cs | 62 +--------- .../HttpRequestTests.cs | 110 ++++++++++++++---- 3 files changed, 106 insertions(+), 79 deletions(-) create mode 100644 src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IPathInfoFeature.cs diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IPathInfoFeature.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IPathInfoFeature.cs new file mode 100644 index 000000000..5fa7e4619 --- /dev/null +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/Adapters/IPathInfoFeature.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#if NET6_0_OR_GREATER +namespace Microsoft.AspNetCore.SystemWebAdapters; + +internal interface IPathInfoFeature +{ + string PathInfo { get; } + + string FileInfo { get; } +} +#endif diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs index da38fc594..76e6a1898 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters/HttpRequest.cs @@ -10,15 +10,12 @@ using System.Security.Principal; using System.Text; using System.Web.Configuration; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Headers; -using Microsoft.AspNetCore.Mvc.TagHelpers; using Microsoft.AspNetCore.SystemWebAdapters; using Microsoft.AspNetCore.SystemWebAdapters.Internal; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; namespace System.Web @@ -53,23 +50,9 @@ internal HttpRequest(HttpRequestCore request) public string? Path => _request.Path.Value; - public string? PathInfo - { - get - { - GetFileInfoPath(out _, out var pathInfo); - return pathInfo.ToString(); - } - } + public string? PathInfo => _request.HttpContext.Features.Get()?.PathInfo ?? string.Empty; - public string? FilePath - { - get - { - GetFileInfoPath(out var filePath, out _); - return filePath.ToString(); - } - } + public string? FilePath => _request.HttpContext.Features.Get()?.FileInfo ?? Path; public NameValueCollection Headers => _headers ??= _request.Headers.ToNameValueCollection(); @@ -201,7 +184,7 @@ public bool IsLocal } } - public string AppRelativeCurrentExecutionFilePath => $"~{_request.Path.Value}"; + public string AppRelativeCurrentExecutionFilePath => $"~{FilePath}"; public string ApplicationPath => _request.HttpContext.RequestServices.GetRequiredService().AppDomainAppVirtualPath; @@ -332,44 +315,5 @@ public int Compare(StringWithQualityHeaderValue? x, StringWithQualityHeaderValue return yValue.CompareTo(xValue); } } - - /// - /// Gets the section of a path that could be interpreted as a file path and the subsequent path. - /// - /// For example: - /// - /// Path: /path/file.txt/subpath - /// FilePath: /path/file.txt - /// PathInfo: /subpath - /// - /// - /// - private void GetFileInfoPath(out StringSegment filePath, out StringSegment pathInfo) - { - var path = new StringSegment(Path); - var extensionIndex = path.LastIndexOf('.'); - - // If no extension, just return the path - if (extensionIndex == -1) - { - filePath = path; - pathInfo = string.Empty; - return; - } - - var endIndex = path.IndexOf('/', extensionIndex, path.Length - extensionIndex); - - // If no filepath, just return the path - if (endIndex == -1) - { - filePath = path; - pathInfo = string.Empty; - } - else - { - filePath = path.Subsegment(0, endIndex); - pathInfo = path.Subsegment(endIndex); - } - } } } diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs index 190263c66..0787cef16 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.Tests/HttpRequestTests.cs @@ -45,7 +45,7 @@ public HttpRequestTests() public void Path() { // Arrange - var path = new PathString("/" + _fixture.Create()); + var path = new PathString(CreateRandomPath()); var coreRequest = new Mock(); coreRequest.Setup(c => c.Path).Returns(path); @@ -58,34 +58,99 @@ public void Path() Assert.Equal(path.Value, result); } - [Theory] - [InlineData("/", "/", "")] - [InlineData("/path", "/path", "")] - [InlineData("/path/", "/path/", "")] - [InlineData("/some/path/", "/some/path/", "")] - [InlineData("/some/path", "/some/path", "")] - [InlineData("/some/path.txt", "/some/path.txt", "")] - [InlineData("/some/path.txt/", "/some/path.txt", "/")] - [InlineData("/some/path.txt/after", "/some/path.txt", "/after")] - [InlineData("/some/path.txt/after/", "/some/path.txt", "/after/")] - [InlineData("/some/path.not/file.txt", "/some/path.not/file.txt", "")] - [InlineData("/some/path.not/file.txt/", "/some/path.not/file.txt", "/")] - [InlineData("/some/path.not/file.txt/subpath", "/some/path.not/file.txt", "/subpath")] - public void FilePath(string path, string expectedFilePath, string expectedPathInfo) + [Fact] + public void FilePathNoFeature() { // Arrange + var context = new Mock(); + context.Setup(c => c.Features).Returns(new FeatureCollection()); + var coreRequest = new Mock(); + var path = new PathString(CreateRandomPath()); coreRequest.Setup(c => c.Path).Returns(path); + coreRequest.Setup(c => c.HttpContext).Returns(context.Object); var request = new HttpRequest(coreRequest.Object); // Act - var filePath = request.FilePath; - var pathInfo = request.PathInfo; + var result = request.FilePath; // Assert - Assert.Equal(expectedFilePath, filePath); - Assert.Equal(expectedPathInfo, pathInfo); + Assert.Equal(path, result); + } + + [Fact] + public void FilePathFeature() + { + // Arrange + var feature = new Mock(); + var path = CreateRandomPath(); + feature.Setup(f => f.FileInfo).Returns(path); + + var features = new FeatureCollection(); + features.Set(feature.Object); + + var context = new Mock(); + context.Setup(c => c.Features).Returns(features); + + var coreRequest = new Mock(); + coreRequest.Setup(c => c.Path).Returns(CreateRandomPath()); + coreRequest.Setup(c => c.HttpContext).Returns(context.Object); + + var request = new HttpRequest(coreRequest.Object); + + // Act + var result = request.FilePath; + + // Assert + Assert.Equal(path, result); + } + + [Fact] + public void PathInfoNoFeature() + { + // Arrange + var context = new Mock(); + context.Setup(c => c.Features).Returns(new FeatureCollection()); + + var coreRequest = new Mock(); + coreRequest.Setup(c => c.Path).Returns(CreateRandomPath()); + coreRequest.Setup(c => c.HttpContext).Returns(context.Object); + + var request = new HttpRequest(coreRequest.Object); + + // Act + var result = request.PathInfo; + + // Assert + Assert.Same(string.Empty, result); + } + + [Fact] + public void PathInfoFeature() + { + // Arrange + var feature = new Mock(); + var path = CreateRandomPath(); + feature.Setup(f => f.PathInfo).Returns(path); + + var features = new FeatureCollection(); + features.Set(feature.Object); + + var context = new Mock(); + context.Setup(c => c.Features).Returns(features); + + var coreRequest = new Mock(); + coreRequest.Setup(c => c.Path).Returns(CreateRandomPath()); + coreRequest.Setup(c => c.HttpContext).Returns(context.Object); + + var request = new HttpRequest(coreRequest.Object); + + // Act + var result = request.PathInfo; + + // Assert + Assert.Equal(path, result); } [Fact] @@ -425,17 +490,20 @@ public void IsLocalNullLocal(bool isLoopback) public void AppRelativeCurrentExecutionFilePath() { // Arrange + var context = new Mock(); + context.Setup(c => c.Features).Returns(new FeatureCollection()); + var coreRequest = new Mock(); coreRequest.Setup(c => c.Scheme).Returns("http"); coreRequest.Setup(c => c.Host).Returns(new HostString("www.A.com")); coreRequest.Setup(c => c.Path).Returns("/B/ C"); coreRequest.Setup(c => c.QueryString).Returns(new QueryString("?D=E")); coreRequest.Setup(c => c.PathBase).Returns("/F"); + coreRequest.Setup(c => c.HttpContext).Returns(context.Object); var request = new HttpRequest(coreRequest.Object); // Act - var url = request.Url; var result = request.AppRelativeCurrentExecutionFilePath; // Assert @@ -1164,5 +1232,7 @@ public void EntityReadMode(ReadEntityBodyMode mode) // Assert Assert.Equal(mode, result); } + + private string CreateRandomPath() => "/" + _fixture.Create(); } } From eca04ec464e066dfa80cecf3c47ef5cde2b8dc24 Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Thu, 9 Feb 2023 14:52:43 -0800 Subject: [PATCH 5/6] Revert "REMOVE: use 7.0.102 SDK" This reverts commit a785993f1700898ca39afd10fce41b4af5d1c622. --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 704df54fd..d8608b9ed 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "7.0.102" + "version": "8.0.100-alpha.1.23061.8" }, "tools": { - "dotnet": "7.0.102", + "dotnet": "8.0.100-alpha.1.23061.8", "runtimes": { "dotnet": [ "6.0.4" From 4145f8c6eafe391f719265935244f4ba7127315b Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Thu, 9 Feb 2023 14:54:10 -0800 Subject: [PATCH 6/6] remove extra files --- .../SystemWebAdapterOptions.cs | 12 ------------ .../SystemWebAdaptersExtensions.cs | 17 ----------------- 2 files changed, 29 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs deleted file mode 100644 index f3cf8af8c..000000000 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdapterOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using Microsoft.Extensions.Primitives; - -namespace Microsoft.AspNetCore.SystemWebAdapters; - -public class SystemWebAdapterOptions -{ - public ICollection Extensions { get; } = new HashSet(StringSegmentComparer.OrdinalIgnoreCase); -} diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs index 8df27cf78..7b564e897 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SystemWebAdaptersExtensions.cs @@ -13,22 +13,6 @@ namespace Microsoft.Extensions.DependencyInjection; public static class SystemWebAdaptersExtensions { - public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollection services, Action configure) - { - services.Configure(configure); - return services.AddSystemWebAdapters(); - } - - private static ISystemWebAdapterBuilder AddDefaultExtensions(this ISystemWebAdapterBuilder builder) - { - builder.Services.Configure(option => - { - option.Extensions.Add(".aspx"); - }); - - return builder; - } - public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollection services) { services.AddHttpContextAccessor(); @@ -38,7 +22,6 @@ public static ISystemWebAdapterBuilder AddSystemWebAdapters(this IServiceCollect services.AddTransient(); return new SystemWebAdapterBuilder(services) - .AddDefaultExtensions() .AddMvc(); }