Mvc 4 beginform with route name

I am creating a form in MVC with @Html.BeginForm(), but my form should send a message to my confirmation, which will display a confirmation.

The confirmation action is simple enough, but the user will be redirected there, and my mapped route looks like this:

    routes.MapRoute(
        name: "RegisterConfirmationRoute",
        url: "register/confirmation",
        defaults: new { controller = "Account", action = "ConfirmRegistration" }
    );

Am I really wrong? I don't see how I can get @Html.BeginFormto use routeName to render the form action attribute?

Regards, Jacques

+5
source share
2 answers

You want to Html.BeginRouteForm("RegisterConfirmationRoute").

+11
source

Have you tried:

Html.BeginForm("ConfirmRegistration", "Account")

I do not understand your question?

+1
source

All Articles