0

I have set-up FBA for my web-application. In Central Administration I have enabled both Windows NTLM Authentication and FBA to it. I thought that

SPClaimProviderManager.IsEncodedClaim(SPContext.Current.Web.CurrentUser.LoginName)

will give be True for FBA users and False for AD users. However, it is returning True for both type of users. Also, SPContext.Current.Web.CurrentUser.LoginName is returning "i:0#.w|domain\internalusername” for internal user and “i:0#.f|fba_membershipprovider|fbausername” for fba users. Why is it so? How do I differentiate them in my code using SPClaimProviderManager?

3

The difference is here:

All Windows Claims contain a 'w':

i:0#.w

And all Forms Claims contain an 'f':

i:0#.f

This would be the best way, in a generic sense, to determine if the user is a Domain or Forms-based user.

This TechNet Wiki article goes into detail about what the various letters and symbols mean.

1
  • That's definetely the good and only answer I know of! – Evariste Sep 15 '16 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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