开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜