It's a pain if you want to use the default form, but just add some attributes. Here is the overloaded method signature that accepts attributes. Therefore, you'll need to also supply the action name, controller name, and form method. The first form you have is setting the RouteValueCollection.
What I've done in the past is create my own helper that circumvents the limitation. Here is an example extension method to short circuit all the other parameters.
using System.Web.Mvc.Html;
namespace MySite.Extensions {
public static class HtmlFormExtensions {
public static MvcForm BeginForm(this HtmlHelper htmlHelper, RouteValueDictionary routeValues, IDictionary<string, Object> htmlAttributes) {
return htmlHelper.BeginForm(null, null, routeValues, FormMethod.Post, htmlAttributes);
}
}
}
Be sure to include your namespace in the view (or all views via web.config), then call it like so:
@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl }, new { @class = "form" }))