title: Can I programmatically prevent a 400 Error from being thrown due to cookie size?
body: <p>My team maintains a suite of C# applications which all share a common set of cookies.</p>
  
  <p>Recently, we had a situation where the cookie size became too large and users began experiencing a 400 error when accessing our production site.  </p>
  
  <p>I wrote a little webforms app that would iterate through a list of our cookies and delete them which did not include our shared code that would try to read/write the cookies in Global.asax:</p>
  
  <pre><code>            foreach (var c in cookieList)
              {
                  HttpCookie currentUserCookie = HttpContext.Current.Request.Cookies[c];
                  if (currentUserCookie != null)
                  {
                      HttpContext.Current.Response.Cookies.Remove(c);
                      currentUserCookie.Expires = DateTime.Now.AddDays(-10);
                      currentUserCookie.Value = null;
                      HttpContext.Current.Response.SetCookie(currentUserCookie);
                  }
              }
  </code></pre>
  
  <p>However, all the pages on our site still threw the error.  The only solution we could find was to have the users manually delete their cookies.</p>
  
  <p>Is there any we can trigger a deletion of our cookies from the server side and save our users the hassle of manually clearing their cookies?  We're using IE11 and Chrome 54.</p>