コントローラー関数の呼び出しに小さな問題があります。奇妙なのは、他のすべての送信ボタンが正常に機能することです。しかし、これには今のところ解決できない問題があります。正常に機能しているのは 1 つだけなので、送信ボタンのある 2 つのフォームを示します。
コントローラ:
public class MyController : Controller
{
public ActionResult MethodOne()
{
...
return RedirectToAction("index");
}
public ActionResult MethodTwo()
{
...
return RedirectToAction("index");
}
}
そしてビュー:
//This one works fine!!
@using (Html.BeginForm("MethodOne", "My", FormMethod.Post))
{
<input id="Some-cool-id" type="submit" value="Add!" />
}
//This one doesn't work?!
@using (Html.BeginForm("MethodTwo", "My", FormMethod.Post))
{
<input id="some-cool-id2" type="submit" value="Delete"!" />
}
エラーは、Method2 が必要なパスにないことを示しています。
Resource not found.
Description: HTTP 404. Searched resource (or ...) ...
Required path URL: /My/MethodTwo
何が悪いのか探していましたが、結局、助けが必要です、ありがとう。