How to use Html.BeginForm in subfolder

Viewed 3619

This is code that work on localhost.

Views Notification/Index.cshtml :

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

But It isn't work on server. When I click submit button this is url.

http://test.com/Notification

And I want this url.

http://test.com/subfolder/Notification

It has subfolder because I use docker on server.

1 Answers

Try this:

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

But I recomend you to rewrite your code with TagHelpers.

Related