Last post Nov 16, 2011 03:14 PM by paparush
Feb 25, 2009 01:53 AM|madhusvuce|LINK
i'm adding cookies to cookies collection of Response object.At particular times the cookies that i'm adding thrugh the code are not appending to cookies collection.Its neither reading cookies from request object as well.This happens after recycling of application
pool in IIS 6.0.
I'm unable to figure out the reason ?
Any ideas about the issue ?
the strange thing is if i restart the IIS then its working fine ? i'm not understanding what http cookie has to do with IIS recycling & IIS restarting ?
Any ideas are desperately awaited
Feb 25, 2009 03:15 AM|Rameezwaheed|LINK
reffer the follwing link for Playing with cookies
Feb 25, 2009 04:05 AM|madhusvuce|LINK
That post doesn't address my problem or my scenario in any way.
Nov 16, 2011 03:14 PM|paparush|LINK
Check the size of the cookie you have created. If it's > 4096 bytes, the Response.Cookies.Add() will fail. Found this out the hard way after spending 2 hours chasing down this issue today. A user was in A LOT of active directory groups. So many in fact
that the encrypted cookie that contained his groups was > 4096 bytes. Had him removed from several groups, dropped the size of his authentication cookie < 4096 bytes and ..bingo! cookie was set and he could log in.
In ASP.NET, I now check the size before calling Response.Cookies.Add() like this:
int iSize = System.Text.UTF8Encoding.UTF8.GetByteCount(authCookie.Values.ToString());
if (iSize > 4096)
//ALERT YOUR USER