1) HttpContext.Current.User == null
2) code running under impersonation.
If it's 2), here's one recipe, save HttpContext, set it to null, restore it back:
HttpContext prev = HttpContext.Current;
HttpContext.Current = null;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
...
});
}
finally
{
HttpContext.Current = prev;
}
No comments:
Post a Comment