asp.net mvc - [HttpPost/HttpGet] vs. [AcceptVerbs(HttpVerbs.Post/Get)]

后端 未结 2 1803
生来不讨喜
生来不讨喜 2020-12-09 01:05

are these things the same?

[HttpPost/HttpGet] vs. [AcceptVerbs(HttpVerbs.Post/Get)]

if not where is a difference?

2条回答
  •  隐瞒了意图╮
    2020-12-09 01:34

    Yes, absolutely the same. [HttpPost/HttpGet] were introduced in ASP.NET MVC 2 to reduce the keystrokes we have to type :-) [AcceptVerbs(HttpVerbs.Post/Get)] could still be used and behave the same although if you are writing new code I would recommend the first.

提交回复
热议问题