HTTP allows different methods that are suited for certain actions to be performed on the server. Theoretically GET
is intended to get resources (such as a web page, but may be a JSON object, too) and hence allows no body at all in the request. While you could misuse custom headers, my advice is to avoid it at any rate possible. Future developers, maybe even your future self, will thank you.
POST
requests, on the other hand, allow data to be posted to the server. According to the spec, one should expect the resource to be altered on the server afterwards, I think, but in the real world it's often misused to transmit login data for quite obvious reasons (you would not want your password to show up in your browser history, which would be the case with GET
requests - which may not hold true anymore since it would not show up with JS HTTP requests, even if the request was a GET
).
So you'd have to alter your controller to allow POST
requests, as Nick said, with the HttpPostAttribute
and replace the link with a form, for links do not allow POST
requests at all (GET
is the default for the browser).
See this question for some more options to use POST
instead of GET
in an HTML page (which would eventually be some kind of form in most cases).