Difference between Html.BeginForm () and Html.BeginRouteForm ()

2

Basically that's my doubt, what difference there is between these two html helpers . and when you should use one or the other.

    
asked by Alan 08.04.2016 в 19:34
source

1 answer

3

The difference is the parameters that take

Html.BeginForm receives the names of the action and the controller :

Html.BeginForm("Edit", "Home")

Html.BeginRouteForm receives the name of a route, if you have named any of them:

Html.BeginRouteForm("MyRoute")

About when to use each one, if you prefer not to follow the convention of /controller/action you can define your own structure for urls, in that case you would create your own routes and name them so you can reference each one easily.

    
answered by 08.04.2016 / 19:38
source