Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logged in Username in Sharepoint 2010 Forms Based Authentication [closed]

When using forms based authentication in Sharepoint 2010, suppose user is logged in with username "admin" and our custom membership provider name is "FBAProvider"... After logging in with this account, logged in user name is displayed like "i:0#.|FBAProvider|admin". How can make it display as it should be like just "admin"?

Thanks in advance,

Mete

like image 639
mbulutay Avatar asked Jan 28 '26 13:01

mbulutay


1 Answers

What code are you using to display the username?

SPContext.Current.Web.CurrentUser

will give you a SPUser object. There are many properties that you can use there, and assuming that your User Information List has the correct information (which it must if you user logs in using only "admin" and not "FBAProvider::admin". Find the field that has the display information that you are looking for.

I'm guessing either Email, LoginName or Name

like image 50
Hugo Migneron Avatar answered Jan 31 '26 09:01

Hugo Migneron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!