after migrating my app from .NET Framework 4.8 to .NET6, Html.BeginForm has started to change the slash into "%2F" in the controller path, which causes problems because then they become unreachable.
Basically, this:
<form action="/Admin/Report/DownloadReport" enctype="multipart/form-data" method="post">
Becomes this:
<form action="/Admin%2FReport/DownloadReport" enctype="multipart/form-data" method="post">
Example of code where it happens:
<div class="form-container">
@using (Html.BeginForm("DownloadReport", "Admin/Report", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.Hidden("requestReportName", "PageReport");
<span class="epi-cmsButton">
<input class="epi-cmsButton-text epi-cmsButton-tools epi-cmsButton-Export" type="submit" name="btnSubmitDownloadPageReport" id="btnSubmitDownloadPageReport" value="Download Report" />
</span>}
</div>
What can be the cause of that strange behavior? I have not found any information that Html.Beginform has became obsolete in .NET6.
Edit: My route mapping:
endpoints.MapControllerRoute(
name: "Admin",
pattern: "Admin/{controller}/{action=Index}");