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.

4

1 回答 1

2

MVC 1 是古老的,但为了做到这一点,您使用 AcceptVerbs 属性

[AcceptVerbs(HttpVerbs.Post)]

或者

[AcceptVerbs(HttpVerbs.Get)] 

等等

于 2015-06-18T15:57:51.540 回答