Keeping these in mind
I’m having trouble wrapping my head around this… Is this code “thread safe” in ASP.NET?
public static bool IsCookieMissing()
{
foreach (string cookieKey in HttpContext.Current.Request.Cookies.AllKeys)
{
if (cookieKey.EndsWith("cookie_name"))
{
return false;
}
}
return true;
}
That depends on what you expect it to do. It most likely does what you expect to do, so it is “thread safe”, unless you are starting your own threads that are calling it.
HttpContext.Currentis the Current HttpContext at which time it was called. Your concern about the issues in this question that you linked to aren’t needed – you aren’t using any closures.