.NET Core minification not working for form HttpPost
See original GitHub issueI’ve followed instructions to implement AspNetCore1 2.3.0 into .NET Core web app. Minification works fine except for single scenario.
I’ve made a simple form that posts to controller, after the post page source isn’t minified.
public class SampleController : Controller
{
[HttpGet]
public IActionResult Verify()
{
return View(); // Minified
}
[HttpPost]
public IActionResult Verify(FoundersVerifyViewModel viewModel)
{
ModelState.AddModelError(string.Empty, "Form posted.");
return View(); // No minification
}
}
And the view
@Html.ValidationSummary()
<form asp-controller="Sample" asp-action="Verify" method="post" class="form-horizontal">
<button type="submit" class="btn btn-default">Verify</button>
</form>
You can’t notice this with “View Page Source” as it makes new request to the page, but it’s apparent if your page displays differently minified/unminified or if you have comments in the html which after form post will appear in the developer tools.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
c# - Bundle Minification not working when publishing ...
Turns out it was ASP.NET form authentication. As according to this, the name of the bundle should not be an existing directory.
Read more >the form Http POST doesn't work, only Get work in asp core ...
I have a Form that should pass data through POST request, but GET request is being used without passing the data and do...
Read more >How we do bundling and minification in ASP.NET Core
The solution suggested in this post is based on not building the minified bundles locally. In theory, this means that the .min files...
Read more >A Step by Step Guide to Bundling and Minification in ASP. ...
Learn how to configure Bundling and Minification in ASP.NET and how to use BuildBundlerMinifier Package and Bundler and Minifier VS ...
Read more >Options for CSS and JS Bundling and Minification with ASP ...
I'm in Visual Studio 2017 and I go File | New Project | ASP.NET Core Web App. Bundling isn't on by default but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aras777 @Xeevis This problem is solved in version 2.4.0.
Use the following settings:
Anyway I was able to fix it by adding line inside post action “Request.Method = “GET”;”, dirty workaround but works till next release 😃