title: ASP .NET Cookie too large after following microsoft tutorial
body: <p>I am following this tutorial:
  <a href="https://docs.microsoft.com/en-us/graph/tutorials/aspnet-core?tutorial-step=3" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/tutorials/aspnet-core?tutorial-step=3</a>
  which basically adds custom claims to the user identity after login. One of the claims is the users profile picture which is stored as a base64 string. This however makes the cookie too large and the webserver fails to load the site. This is the code for adding the picture:</p>
  <pre><code>var photo = await graphClient.Me
                                  .Photo
                                  .Content
                                  .Request()
                                  .GetAsync();
  
  
  
  var memoryStream = new MemoryStream();
  photo.CopyTo(memoryStream);
  var photoBytes = memoryStream.ToArray();
  
  photoUrl = $&quot;data:image/png;base64,{Convert.ToBase64String(photoBytes)}&quot;;
  </code></pre>
  <p>The photo is fetched from the Microsoft Graph API and is returned as a Stream which I convert to base64 string. Am I missing something? Any assistance will be really appreciated.</p>