How can I send a cookie from a Web.Api controller method
See the question and my original answer on StackOverflowWith recent versions of Web API, async, and IHttpActionResult, we can now simply do this:
public async Task<IHttpActionResult> MyMethod(... myParameters ...)
{
...
var cookie = new CookieHeaderValue("myCookie", "myValue");
...
var resp = new HttpResponseMessage();
resp.StatusCode = HttpStatusCode.OK;
resp.Headers.AddCookies(new[] { cookie });
return ResponseMessage(resp);
}