Hi Bill,
Actually I can put a catch for that null reference exception in there though it is unclear to me what could be null since we are checking for null on all relevant things in this code:
public override string[] GetRolesForUser(string userName)
{
if (HttpContext.Current != null)
{
SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
string roleCookieName = SiteUtils.GetRoleCookieName(siteSettings);
if ((HttpContext.Current.Request.IsAuthenticated)
&& (HttpContext.Current.User.Identity.Name == userName)
&&(siteSettings != null)
)
{
if (
(CookieHelper.CookieExists(roleCookieName))
&& (CookieHelper.GetCookieValue(roleCookieName).Length > 0)
)
{
try
{
return GetRolesFromCookie();
// the below errors are expected if the machine key has been changed and the user already has a role cookie
// apparently the update for http://weblogs.asp.net/scottgu/archive/2010/09/28/asp-net-security-update-now-available.aspx
// changed it from throwing a CryptographyException to an HttpException
}
catch (System.Security.Cryptography.CryptographicException)
{
return GetRolesAndSetCookie();
}
catch (HttpException)
{
return GetRolesAndSetCookie();
}
}
else
{
return GetRolesAndSetCookie();
}
}
else
{
// not current user or not authenticated
if ((siteSettings != null) && (userName != null) && (userName.Length > 0))
{
return SiteUser.GetRoles(siteSettings, userName);
}
}
}
return new string[0];
}
I'll add a catch for nullreferenceexception there for the next release so it won't crash the page but it still could have unexpected results (and you'll still see it in the logs because I don't want to swallow an error without logging it). Its like having a weird proxy server in between the browser and the actual web site.
You might ask the user to try it with the acceleration disabled since some people are reporting it is actually faster without it enabled.
Best,
Joe