Why action not found in my controller?
I have this code:
return RedirectToAction("Save", "RequestFinishedDocument",
new {requestId = requestFinished.Request_ID, requestFinishedId = requestFinished.ID});
And in my controller I have:
public class RequestFinishedDocumentController : Controller
{
[HttpPost]
public JsonResult Save(int requestId, int requestFinishedId)
{
//todo
}
}
But on the RedirectToAction call I get the exception 开发者_如何学Pythonmessage: A public action method 'Save' was not found on controller 'SuiP.Controllers.RequestFinishedDocumentController'.
What's wrong?
Thank
RedirectToAction
performs a HTTP GET. Your action method only accepts a HTTP POST.
Try changing it to:
public class RequestFinishedDocumentController : Controller
{
[HttpGet]
public JsonResult Save(int requestId, int requestFinishedId)
{
//todo
}
}
and see if that works.
精彩评论