Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top