SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm getting Windows users' profiles, in my webpart, doing the following:

UserProfileManager pm = new UserProfileManager(SPServiceContext.Current);
SPUser spuser = web.AllUsers.GetByID(user.Id);
UserProfile up = pm.GetUserProfile(spuser.LoginName);

When it comes to a FBA user, the second line will raise an exception. So, I guess there's another way to get FBA users' profile. Could anyone tell me how to do it?


share|improve this question
which exception? – Steve B Jun 21 '12 at 20:13

Hi did you get anywhere with this? I have a similar problem, where the profile hasn't been created yet for the fba user so I'm trying to create it in code at the user creation level, but having no such luck. I've written a more complete post at: FBA User Profile Creation Access Denied

If anyone can help, that would be ace.

thanks, Bav

share|improve this answer

What is the user object? How is that loaded?

Instead of web.AllUsers.GetById, try web.SiteUsers.GetById. This will include all users in the site collection.

share|improve this answer
I get the user object from a parallel database (not the SharePoint one). – Brian Roisentul Feb 14 '12 at 13:02
and is their SharePoint ID, i.e. 1, 2, 32, 100? – David Lozzi Feb 14 '12 at 13:19
Exactly. Anyway, I'm getting the same error doing what you suggested :S – Brian Roisentul Feb 15 '12 at 23:20
What's the error message? Do you have anonymous access enabled? – David Lozzi Feb 16 '12 at 1:16
I also wonder if you can use SPServiceContext.Current, since you're not running in context as I understand. Would be better if you could post the entire code snippet. – Jasper Apr 19 '12 at 15:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.