Search code examples
asp.net-mvcasp-net-mvc-1

HttpPost in MVC 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.


Solution

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

    [AcceptVerbs(HttpVerbs.Post)]
    

    or

    [AcceptVerbs(HttpVerbs.Get)] 
    

    etc.