You've got one too many "Set-Cookie" in there and you don't need to trailing semi-colon.
server.sendHeader("Set-Cookie", "cookiename=cookiecontent;expires=31536000");
You've got one too many "Set-Cookie" in there and you don't need to trailing semi-colon.
server.sendHeader("Set-Cookie", "cookiename=cookiecontent;expires=31536000");