Using the LoginName Control

The LoginName control displays the current user’s registered username. If the current user is not authenticated, the LoginName control renders nothing.

The page in Listing 26.29 contains both a LoginName and LoginStatus control.

Listing 26.29. ShowLoginName.aspx

images

When you first open the page in Listing 26.29, the LoginName control displays nothing. However, if you login by clicking the Login link, the LoginName control displays your username (see Figure 26.12).

Figure 26.12. Displaying the current username with the LoginName control.

The LoginName control supports the following property:

FormatString Enables ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.