Display Hello John Doe Instead of Hello [email protected]


https://forum.kartris.com/Topic6336.aspx
Print Topic | Close Window

By shulemj - Thu 31 Dec 2015
It's as simple as my header says - and I can't believe no one complained on that. I want to display "Hello John Doe" instead of "Hello [email protected]" once the customer logs in. I know basic ASP.NET, but can someone please direct me to the page that needs modification?

Thanks in advance.
By jcosmo - Fri 1 Jan 2016
The place that needs the modification is UserControls/Skin/LoginStatus.ascx.

The code in place is just the default LoginName control. So you'll need to write a function to retrieve the Full Name based on the logged in user and set the FormatString on the LoginName control to the Full Name you retrieve.
By shulemj - Tue 5 Jan 2016
Thanks. I figured it the exact coding to be simple and minimal.

Go to UserControls > Skin > LoginStatus.ascx > LoginStatus.ascx.vb

Between the If line and the Else lines add the following two lines of VB:

Dim arrNameAndVAT As Array = Split(UsersBLL.GetNameandEUVAT(DirectCast(Page, PageBaseClass).CurrentLoggedUser.ID), "|||")
KartrisLoginName.FormatString = arrNameAndVAT(0)
By shulemj - Fri 8 Jul 2016
My previous solution doesn't work anymore. Where is the code behind asp:LoginName?
By Tiggywiggler - Fri 8 Jul 2016
Why doesn't it work? Have you tried breakpointing the code to find out where the issue occurs? Maybe you are not getting the user ID at the point that you are calling the function?

To answer your question directly, the user name will come from the membership provider, Kartris has a custom membership provider but they do not implement the Public Overloads Overrides Function GetUser(ByVal providerUserKey As Object, ByVal userIsOnline As Boolean) As System.Web.Security.MembershipUser method. when called this method returns Nothing for all paths.
By shulemj - Wed 13 Jul 2016
If I remember correctly, LoginStatus.ascx.vb had the code to populate the asp:LoginName control, but now I don't know where the code is now.