开发者

Posting form to controller action not working in production environment

开发者 https://www.devze.com 2023-04-01 12:39 出处:网络
2 days I\'ve been trying to get my head around this开发者_JAVA百科, but no joy. I have a simple form that posts to a controller action.The form posts, but it doesn\'t appear to go through the control

2 days I've been trying to get my head around this开发者_JAVA百科, but no joy.

I have a simple form that posts to a controller action. The form posts, but it doesn't appear to go through the controller action routine as no validation or form field binding occurs - on the dev environment, the fields are populated from the request (I assume by the helper) and validation summary is displayed.

Html

<form method="post" action="/Contact">...fields and submit...</form>

Controller

[HttpPost]
public ActionResult Contact(ContactModel model)
{
     View(model);
}

When I refresh the page after a post back, I don't get asked to re-post the values which makes me think something somewhere is causing a redirect but this doesn't happen in the dev env.

Anyone have any bright ideas? The error logger doesn't seem to report any 500's behind the scenes so nothing there to help.


This was all due to missing / (slash) at the end... The good lord above only knows why.

Updated to include code

<form method="post" action="/Contact/">...fields and submit...</form>

Note the slash at the end of the action attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号