Using the LoginName and LoginStatus Server Controls

On many Web sites, when users are logged in, their user name appears on the site along with the ability to log out of the site. Fortunately, ASP.NET has LoginName and LoginStatus server controls that do just that. The LoginName server control displays the name of the logged-on user. The LoginStatus server control is a dynamic link that enables the user to log out of the site. On a Web site, these controls are beside each other.

To add the LoginName and LoginStatus server controls to the Default.aspx page

  1. Close the browser window and stop running the site. In Visual Web Developer, double-click Default.aspx to open it in the editor.

  2. Select the Design tab in the editor to show the design surface.

Get Microsoft® Visual Web Developer™ 2008 Express Edition Step by Step 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.