1

I have a page where users are editing some content. If the authentication on that page expires, and they press the "Save" button, since their session is timed out, they are redirected to the login page. However, when they re-authenticate, the redirect does a GET on the page when I'm expecting a POST, so it generates a HttException "A public action method 'Close' was not found on controller 'HLPUSD.HEAT.Web.Controllers.TicketController."

What do I need to do to resolve this?

EDIT

Exception:

System.Web.HttpException (0x80004005): A public action method 'SavePrecedence' was not found on controller 'HLPUSD.HEAT.Web.Controllers.QueueController'.
at System.Web.Mvc.Controller.HandleUnknownAction(String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__4()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nick DeVore
  • 9,748
  • 3
  • 39
  • 41
  • My problem is similar to this post but their specific problem was not mine, nor the solution http://stackoverflow.com/questions/1745182/intermittent-asp-net-mvc-exception-a-public-action-method-abc-could-not-be-foun – Nick DeVore Apr 15 '11 at 19:57
  • That is to say my problem is not an ajax call but just a plain ole' normal GET/POST problem – Nick DeVore Apr 15 '11 at 21:39

1 Answers1

1

If you respect the following conventions:

public ActionResult Foo()
{
    ...
}

[HttpPost]
public ActionResult Foo(SomeViewModel model)
{
    ...
}

where the first action renders a form and the second action is used to handle the submission of this form it will work as you have both GET and POST actions for this resource and in the described scenario the users will simply be redirected to GET /SomeController/Foo which will simply render the form once again.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • That is exactly my problem. My GET method is called 'Details(int ticketId)' while my POST method is called 'Close(TicketViewModel ticket)'. Do you think adding the 'ActionName("Details")' decorator to my POST method will solve the problem or do I need to rethink my apprach? – Nick DeVore Apr 18 '11 at 19:20
  • I finally got this implemented. It did indeed solve the problem. Thanks for the help. – Nick DeVore Apr 27 '11 at 14:40