Currently, part of my application sends out emails to users reminding them of events or tasks. When clicking a MarkComplete link in the email client, an HTTP Get request is made to my ActionHandler.ashx (an HTTPHandler) where the QueryString parameters are inputs allowing for the update of the event/task. New emails are then emitted back to the client signalling completion. This works.
An unwanted side-effect of this HTTP GET to the handler is the launching of the browser (i.e. at this point, the opening of the browser is unneeded and a nuisance).
Premise: As I study up on the ASP.Net Web Api, I am thinking I might be able to refactor the small amount of code in my HTTPHandler into a PUT method in a Web API controller. My understanding is that this controller could respond with void return (HTTP status code 204) after doing the required processing described above.
Question: Can the above approach in a newly written PUT method in a Web API controller return 204 and will this prevent the browser from launching completely? I want the end-user to click the link in his first email and only get the newly constructed email message signaling "completion" (no browser at all here).
EDITs to clarify 22 May 2016:
- I do NOT NEED "user interaction". Ideally, the user clicks and nothing happens to the user than a new "answering email" indicating successful completion of the task.
- Option 2 listed in proposed answer below has already been tried unsuccessfully and some major email programs do not allow this - see: Submit to HttpHandler results in RequestType GET instead of POST
- Please note the HTML email content currently emitted does NOT contain any HTML form tag(s) bracketing the link tags in the message.
- Do I still indeed have NO options? I have read that HTTP PUT can process a querystring (I just don't know exactly how to do so yet...)