ASPXAUTH cookie is not being saved

梦想的初衷 提交于 2019-12-05 07:31:29
Stéphane

This could be that your cookie grew too big. I ran into the same issue. If your cookie becomes too big, it just won't work, depending on the browser of course

MSDN

cookies are usually limited to 4096 bytes and you can't store more than 20 cookies per site. By using a single cookie with subkeys, you use fewer of those 20 cookies that your site is allotted. In addition, a single cookie takes up about 50 characters for overhead (expiration information, and so on), plus the length of the value that you store in it, all of which counts toward the 4096-byte limit. If you store five subkeys instead of five separate cookies, you save the overhead of the separate cookies and can save around 200 bytes.

What is the maximum size of a web browser's cookie's key?

what happens when cookies file exceeds maximum size?

An easy way to check your cookies size is to debug and run the following code

int cookieSize = System.Text.UTF8Encoding.UTF8.GetByteCount(faCookie.Values.ToString());

If this is over the limit then you will be encountering issues.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!