I realized this ... when I checked if the user was authenticated, I used the following code ...
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
{
return true;
}
when I deleted the first check (i.e.HttpContext.Current.User! = null), it started working. Although I really don't understand how HttpContext.Current.User.Identity.IsAuthenticated can be true if HttpContext.Current.User is null.
In any case, it works now, so no problem.