Archive for September, 2012

when all else fails

September 11, 2012

kind of a comment on that last post – actually, I had the code correct for about 15 minutes or so,  and continued to get 404 errors, and also my test html page did not reflect the posting url in the latest copy of the html file  in my project (which was weird). So I went to the trusty IE/tools/in private browsing to make sure I was starting from a clean playing field, and it all worked.

Too bad that the cached junk had led me down a few stray rabbit trails.

How to post an html form to mvc

September 11, 2012

1)     The controller name isCompletionController. The URL of the form action is:

<form action=”http://localhost:36102/Completion/ReceiveCompletionForm” method=”post”>

Note that the url doesn’t contain “Controller”

2)     The controller looks like this:

[HttpPost]
public ActionResult ReceiveCompletionForm(FormCollection collection)
{

3)     I didn’t define a route – this was my default global.asax

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

Note that there is nothing in the route about the FormCollection input to the controller.