This could come in ASP/JSP if u have knowledge about them.
In ASP , there is a Response Object, which allows you to create cookies, using the Response.Cookies() Collection.
For more on that check
http://www.w3schools.com/asp/asp_cookies.asp
Hope this helped!