2
I have a view with the following form:
@using (Html.BeginForm("Salva", "Blog", new { area = "admin" }, FormMethod.Post, false, new { id = "formCadastro" }))
However, when clicking on Ubmit the url that appears is the following
But I need her to show up like this:
My mapping is as follows:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapAreaControllerRoute(
name:"Admin",
areaName: "Admin",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
});
But I’ve used it too:
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("Admin", "{controller=Home}/{action=Index}/{id?}");
});
I would recommend you to stop using this kind of syntax in this version of mvc and switch to the new Razor markup template. Take a look at this tutorial https://docs.microsoft.com/pt-br/aspnet/core/tutorials/razor-pages/? view=aspnetcore-2.2
– Leandro Angelo