As I were creating the a feature for site, I needed to check if a visitor already has given kudos to an article before. An easy way to do that (in my mind) is to randomly generate a GUID and store that in the browser to somehow recognize the browser/visitor again.
But all articles, blogs and SO post on handling cookies in ASP.Net Core all focus on dependency inject the IHttpContextAccessor or use the HttpResponse property on the ASP.Net Core controller it self to gain access to the ResponseCookies . None of these methods works out of the box in Azure Functions! 🥺
But after some time searching and a little rubber ducking I realized that the HttpContext (and therefore the HttpResponse and its cookies) where accessible trough the incoming HttpRequest in the HttpTrigger. So when you know, pretty easy. Se below example.
After that i ran into some troubles with CORS, SameSite and other security related stuff, because my blog is a static website calling a Azure Function on another domain (but that is another post 🤔).