如何在子文件夹中使用Html.BeginForm

时间:2017-10-04 09:57:31

标签: asp.net-core-mvc .net-core

这是适用于localhost的代码。

观看通知/ Index.cshtml:

@using(Html.BeginForm("Index","Notification",FormMethod.Post))
{
 ...

但它不适用于服务器。 当我点击提交按钮时,这是网址。

http://test.com/Notification

我想要这个网址。

http://test.com/subfolder/Notification

它有子文件夹,因为我在服务器上使用了docker。

1 个答案:

答案 0 :(得分:0)

试试这个:

Html.BeginForm("Index", "Notification", new {area="subfolder"}, FormMethod.Post)

但我建议您使用TagHelpers重写代码。

相关问题