0

I have a site setup using Claims Based (Forms) authentication with Anonymous access enabled.

When a user logs into the site they may exist in the Forms Database, but not in the SharePoint Site collection. In this case SPContext.Current.Web.SPUser returns NULL - even though they are logged in.

Is there another object similar to SPUser that I can use?

EtherDragon
  • 2,679
  • 1
  • 18
  • 24

1 Answers1

2

Is HttpContext.Current.User.Identity.IsAuthenticated == true? If so, try putting a call to SPContext.Current.Web.EnsureUser(HttpContext.Current.User.Identity.Name) before digging into Web.CurrentUser (which is what I presume you meant, not Web.SPUser)

-Oisin

x0n
  • 51,312
  • 7
  • 89
  • 111
  • that might be Web.User too (can't remember) – x0n Jun 24 '10 at 17:27
  • This, is - in fact, what I ended up doing. =) if (HttpContext.Current.User.Identity != null) { IIDentity myIdent = HttpContext.Current.User.Identity; // Do some more identity stuff } – EtherDragon Jun 25 '10 at 16:32