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.

  • change 'role' for the name of your membership provider. – James Love Jan 5 '13 at 13:27
  • 2
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.