The problem with learning MVC today is how to differentiate whether a request is a GET request or a POST request, and I hope to share it with you.
When I request a method of a controller class in a view, sometimes it is necessary to have a method of the same name, but to distinguish between the two methods. So I added [HttpPost] and [HttpGet] in front of the method to distinguish between a get or a POST request.
[HttpPost]
Public ActionResult Permissionson (formcollection form) {}
[HttpGet]
Public ActionResult Permissionson () {}
Then came the problem that bothered me, I visited this controller method, but this is not like a form can specify the post or get Submit method, I originally thought that after the URL parameter must be a GET request,
But the URL: '/admin/sys/[email protected][' pid ',
When this sentence request method I see is a post submission, so I Baidu for a long time, finally clarified the GET request and POST request:
1. As long as the URL request, must be a GET request!
2. If it is a URL request, but it is a POST request, it is likely that the request is in some containers, such as the problem I encountered here is because the Easyui DataGrid itself is the default post request.
How to differentiate get requests from post requests