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 have a Form Based Authentication login name login_name

how to get an SPUser object for that login name.

I have tried the

Web.EnsureUser(string.Format("c:0-.f|role|{0}", name));

but it gives me that the name was not found exception.

share|improve this question
change 'role' for the name of your membership provider. – James Love Jan 5 '13 at 13:27
My comment above will probably resolve your immediate requirement, but I also have a similar requirement for getting an SPUser for a username from a claim that can be from any issuer (forms, windows, trusted IP), so if someone has a more complete answer, I'd be grateful, too :) – James Love Jan 5 '13 at 13:28

Your Answer


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

Browse other questions tagged or ask your own question.