1

I have this code:

SPWeb theSite = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);
SPUser theUser = theSite.CurrentUser;
string strUserName = theUser.LoginName.ToLower();

How to remove i:0#.w| in Shareoint 2013. Please help.

3

This should do the trick

SPWeb theSite = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);
SPUser theUser = theSite.CurrentUser;
string strUserName = theUser.LoginName.ToLower();
string strUserName = strUserName.IndexOf('|') > -1 ? strUserName.Split('|')[1] : strUserName

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.