Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, February 25, 2009 1:53 AM
Hi
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
All replies (3)
Wednesday, February 25, 2009 3:15 AM
Hi
reffer the follwing link for Playing with cookies
http://www.codeproject.com/KB/aspnet/Beginners_Cookies.aspx
Best Regards
Wednesday, February 25, 2009 4:05 AM
That post doesn't address my problem or my scenario in any way.
Wednesday, November 16, 2011 3:14 PM
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
return;
}