# How to create custom cookies in HTTP Triggered Azure Functions

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 ](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpresponse?view=aspnetcore-5.0) property on the ASP.Net Core controller it self to gain access to the  [ResponseCookies](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iresponsecookies?view=aspnetcore-5.0) . 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.

%[https://gist.github.com/jacobmohl/cf90c5d38185eed3782cfe0b393f03c7]

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 🤔).
