1

I have to maintain a project that uses MVC 1. It seems like it doesn't know anything about [HttpPost], and the same action method is called for both get and post. What is the right way to distinguish between creating a view and submitting the form data?

Thanks.

2
  • possible duplicate of post and get with same method signature Commented Jun 18, 2015 at 16:00
  • No, it is not a duplicate. I did not try to use the same signature. Commented Jun 19, 2015 at 14:12

1 Answer 1

2

MVC 1 is ancient but in order to do that you use the AcceptVerbs attribute

[AcceptVerbs(HttpVerbs.Post)]

or

[AcceptVerbs(HttpVerbs.Get)] 

etc.

Sign up to request clarification or add additional context in comments.

2 Comments

So the full solution can be seen here: stackoverflow.com/questions/724386/… The AcceptVerbs gives you HttpPost/Get but you also need to have the additional signature changes.
Never mind, I needed to specify method="post" on the form. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.