ok

alphons <alphons@heijden.com> 3 Mar 2026, 12:09
9db50f530aa28ff48e361e0f263e6f5f05d62b70
6 files changed
  • NetproxySolution.sln
  • tests/Netproxy.Testing/Controllers/ComplexController.cs
  • tests/Netproxy.Testing/CustomFormValueProviderFactory.cs
  • tests/Netproxy.Testing/Netproxy.Testing.csproj
  • tests/Netproxy.Testing/Netroxy.Testing.csproj
  • tests/Netproxy.Testing/Program.cs
diff --git a/NetproxySolution.sln b/NetproxySolution.sln
new file mode 100644
index 0000000..6bdaff4
--- /dev/null
+++ b/NetproxySolution.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 18
+VisualStudioVersion = 18.1.11312.151
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netproxy.Web", "src\Netproxy.Web\Netproxy.Web.csproj", "{CB5A484C-8720-42F0-AD4F-229C23A4029F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Netproxy.Testing", "tests\Netproxy.Testing\Netproxy.Testing.csproj", "{E3B61230-E676-CA37-4BB4-ECE447E02513}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CB5A484C-8720-42F0-AD4F-229C23A4029F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CB5A484C-8720-42F0-AD4F-229C23A4029F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CB5A484C-8720-42F0-AD4F-229C23A4029F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CB5A484C-8720-42F0-AD4F-229C23A4029F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E3B61230-E676-CA37-4BB4-ECE447E02513}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E3B61230-E676-CA37-4BB4-ECE447E02513}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E3B61230-E676-CA37-4BB4-ECE447E02513}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E3B61230-E676-CA37-4BB4-ECE447E02513}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {3077B12D-FD9C-49A1-B06F-696591A75B92}
+ EndGlobalSection
+EndGlobal
diff --git a/tests/Netproxy.Testing/Controllers/ComplexController.cs b/tests/Netproxy.Testing/Controllers/ComplexController.cs
index 1dbe6c5..514fb91 100644
--- a/tests/Netproxy.Testing/Controllers/ComplexController.cs
+++ b/tests/Netproxy.Testing/Controllers/ComplexController.cs
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.ModelBinding.MultiParameter;
#nullable disable
@@ -261,7 +260,6 @@ public class ApiController : ControllerBase
[HttpPost("~/api/DemoProposal/{SomeParameter2}")]
public async Task<IActionResult> DemoProposal(
- [FromCooky(Name = ".AspNetCore.Session")] string SomeParameter0,
[FromHeader(Name = "Referer")] string SomeParameter1,
[FromRoute] string SomeParameter2,
[FromQuery] string SomeParameter3,
@@ -273,7 +271,6 @@ public class ApiController : ControllerBase
return Ok(new
{
- SomeParameter0,
SomeParameter1,
SomeParameter2,
SomeParameter3,
@@ -285,7 +282,7 @@ public class ApiController : ControllerBase
[HttpPost("~/api/DemoProposal2/{SomeParameter2}")]
- public async Task<IActionResult> DemoProposal(
+ public async Task<IActionResult> DemoProposal2(
string Referer,
string SomeParameter2,
string SomeParameter3,
diff --git a/tests/Netproxy.Testing/CustomFormValueProviderFactory.cs b/tests/Netproxy.Testing/CustomFormValueProviderFactory.cs
deleted file mode 100644
index 5eb60c5..0000000
--- a/tests/Netproxy.Testing/CustomFormValueProviderFactory.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-using System.Globalization;
-
-namespace Mvc.ModelBinding.MultiParameter.Testing
-{
- public class CustomFormValueProviderFactory : IValueProviderFactory
- {
- public Task CreateValueProviderAsync(ValueProviderFactoryContext context)
- {
- ArgumentNullException.ThrowIfNull(context);
-
- // Check if the request is of the correct content type
- if (context.ActionContext.HttpContext.Request.ContentType == "application/x-www-form-urlencoded" ||
- context.ActionContext.HttpContext.Request.ContentType.StartsWith("multipart/form-data"))
- {
- var formCollection = context.ActionContext.HttpContext.Request.Form;
- var valueProvider = new FormValueProvider(
- BindingSource.Form,
- formCollection,
- CultureInfo.CurrentCulture
- );
-
- context.ValueProviders.Add(valueProvider);
- }
-
- return Task.CompletedTask;
- }
- }
-}
diff --git a/tests/Netproxy.Testing/Netproxy.Testing.csproj b/tests/Netproxy.Testing/Netproxy.Testing.csproj
index c738477..1d3b8fc 100644
--- a/tests/Netproxy.Testing/Netproxy.Testing.csproj
+++ b/tests/Netproxy.Testing/Netproxy.Testing.csproj
@@ -8,7 +8,8 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="netproxy" Version="3.0.1" />
+ <PackageReference Include="netproxy" Version="10.0.2" />
+ <PackageReference Include="VanDerHeijden.JsonBodyProvider" Version="10.0.4" />
</ItemGroup>
<ItemGroup>
@@ -20,9 +21,4 @@
</Content>
</ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\Mvc.ModelBinding.MultiParameter\Mvc.ModelBinding.MultiParameter.csproj" />
- </ItemGroup>
-
</Project>
diff --git a/tests/Netproxy.Testing/Netroxy.Testing.csproj b/tests/Netproxy.Testing/Netroxy.Testing.csproj
deleted file mode 100644
index c738477..0000000
--- a/tests/Netproxy.Testing/Netroxy.Testing.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
-
- <PropertyGroup>
- <TargetFramework>net10.0</TargetFramework>
- <Nullable>enable</Nullable>
- <ImplicitUsings>enable</ImplicitUsings>
- <ServerGarbageCollection>true</ServerGarbageCollection>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="netproxy" Version="3.0.1" />
- </ItemGroup>
-
- <ItemGroup>
- <Content Update="wwwroot\*">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Update="wwwroot\*\*">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
-
-
- <ItemGroup>
- <ProjectReference Include="..\Mvc.ModelBinding.MultiParameter\Mvc.ModelBinding.MultiParameter.csproj" />
- </ItemGroup>
-
-</Project>
diff --git a/tests/Netproxy.Testing/Program.cs b/tests/Netproxy.Testing/Program.cs
index e49be08..f665097 100644
--- a/tests/Netproxy.Testing/Program.cs
+++ b/tests/Netproxy.Testing/Program.cs
@@ -1,10 +1,14 @@
+using VanDerHeijden.JsonBodyProvider;
+
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
// the 'real' root of the application
ContentRootPath = AppDomain.CurrentDomain.BaseDirectory
});
-builder.Services.AddMvcCore().WithMultiParameterModelBinding(SanitizeAll: true);
+builder.Services.AddMvcCore();
+
+builder.Services.AddJsonBodyProvider();
builder.Services.AddDistributedMemoryCache();