表格助手如何确定渲染形式的动作?

问题描述 投票:0回答:0
UserController

。我觉得我在这里打破了任何新的地面。

如果我到达此URL:
Edit

我有一个看起来像这样的视图:

/Profile/User/Edit/100


为什么这样做这样的html渲染:

<form method="post" role="form" asp-controller="User" asp-action="Edit">


instead(请注意“/100”):

<form method="post" role="form" action="/Profile/User/Edit">

我意识到我可以辅助标签助手或以其他方式工作,但似乎这应该“工作”。

这是我当前配置我的路线的方式:

<form method="post" role="form" action="/Profile/User/Edit/100">

	

订购路线时,请确保将较大段数的路线放在路线上,段数较少。另外,为什么您需要上面的2条类似的外观路线?

在修改以下路线之后,您可以尝试吗?

app.UseMvc(routes => { routes.MapRoute( name: "areaRoute", template: "{area:exists}/{controller=Home}/{action=Index}"); routes.MapRoute( name: "default", template: "{area:exists=Home}/{controller=Home}/{action=Index}/{id?}"); });

	
asp.net-core .net-core asp.net-core-mvc asp.net-core-1.0
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.