title: Passing date parameters to @url.action via ajax
body: <p>In my ASP.NET MVC 4 app, I'm using the following JAX code taken from this <a href="https://stackoverflow.com/questions/9745139/building-relative-urls-for-an-mvc-app-with-javascript/9745226#9745226">StackOverflow post</a> to pass Date parameters to a controller but I am getting the following http 404 error: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Requested URL /myWebApp/myController/myAction/01/01/2014/12/31/2014"</p>
  
  <p>Here the input controls txtFrom and txtTo have the values 01/01/2014 and 12/31/2014 respectively. the issue is that MVC is probably interpreting each date as three different parameters. How can we fix it. I tried replacing $('#txtFrom').val() with $('#txtFrom').val().replace("///g", "_") but it does not work.</p>
  
  <pre><code>window.location.href = '@Url.Action("myAction")/' + $('#txtFrom').val() + '/' + $('#txtTo').val();
  </code></pre>
  
  <p><strong>Action method</strong>:</p>
  
  <pre><code>public ActionResult myAction(string startDate, string endDate)
  {
   //simple code here to use the input parameters
  }
  </code></pre>