On an MVC 1.0 site, Right out of the box, if I add an input type=submit button to a form created with Html.BeginForm i'll get an action of "/Default.aspx? This is not what I was expecting. This seems to be the case only with the sp-called default view.
The upshot of all this, that there will be a /defaul.aspx? in the addressbar when the user submits the form, which is obvioulsy undesirable in an MVC app.
I'm guessing I have to either name the route in the BeginForm, or change something in the Routing table. Coupl somebody confirm that assumption, and secondly, while I'm ok with either option, I would like to know why.
Here's some code to make things clearer: Add this to the Home/Index.aspx view
<%using (Html.BeginForm())
{ %>
<label for="input">Enter something here:</label>
<%= Html.TextBox("input") %>
<input type="submit" value="Submit" />
<%} %>
Add this to the HomeController.cs
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(string input)
{
return View((object)Service.Text.Reverse(input)); // just a simple utility to flip the string order
}
Observe that when you press the submit buttion you'll get a default.aspx? (this is MVC 1.0)