title: MVC3 Html.BeginForm - passing arguments as RouteValueDictionary fails
body: <p>I have a multi-step setup process where I would like to pass query string arguments appended to the URL only if they are relevant.</p>
  
  <p><a href="http://localhost:6618/Account/Profile?wizard=true&amp;cats=dogs" rel="noreferrer">http://localhost:6618/Account/Profile?wizard=true&amp;cats=dogs</a></p>
  
  <p><code>@using( Html.BeginForm() )</code></p>
  
  <p>worked great. It yielded: <code>&lt;form action="/Account/Profile?setup=true&amp;amp;cats=dogs" method="post"&gt;</code> i.e. it passed into the POST action any of the original query string parameters, and then in that Controller action I could chose which ones were relevant to pass to my next step, or necessary to add, by adding to the RouteValues and a  RedirectToResult. </p>
  
  <p>However, I need to assign a class to my form for styling purposes.</p>
  
  <p>I tried:</p>
  
  <p><code>@using( Html.BeginForm( "Profile", "Account", args, FormMethod.Post, new { @class = "mainForm" } ) )</code></p>
  
  <p>which yields:</p>
  
  <p><code>&lt;form action="/Account/Profile?Count=1&amp;amp;Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&amp;amp;Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D" class="mainForm" method="post"&gt;</code></p>
  
  <p>(<code>args</code> was generated by a filter, and is a RouteValueDictionary). The specification <a href="http://msdn.microsoft.com/en-us/library/dd505151.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/dd505151.aspx</a> indicates that you can pass arguments with a System.Web.Routing.RouteValueDictionary.</p>
  
  <p>What I want is <code>&lt;form action="/Account/Profile?setup=true&amp;amp;cats=dogs" class="mainForm" method="post"&gt;</code></p>
  
  <p>I should mention I would prefer not to do something like passing in <code>new {key = value}</code> instead, since there is a fair amount of logic to determine what I will be passing along to the next step.</p>
  
  <p>Any suggestions on what to do here?</p>
  
  <p>I am stymied by this seemingly simple task, and am surely missing something terribly obvious.  </p>