LoginView control

The LoginView control allows you to display different information to anonymous and logged-in users.

To add a LoginView control to a page

  1. Drag the LoginView control from the Toolbox task pane to your page.

  2. By default, the LoginView control includes two templated views that are displayed to the user. The first is the AnonymousTemplate, which is displayed to the user when the user is not logged in. The second template is the LoggedInTemplate, which defines the user interface that is displayed when a user is logged in. But you can also create templates for the members of particular logged-in role groups.

For information about ASP.NET roles, see Understanding Role Management in the MSDN library.

To add RoleGroups for your LoginView control

  1. In Design view, right-click the LoginView control, and then click Show Common Control Tasks.

  2. On the Common LoginView Tasks menu, click Edit RoleGroups.

  3. In the RoleGroup Collection Editor dialog box, click Add.

  4. Specify the roles in the Roles property in the Properties area.

To switch between the LoginView control templates

  1. In Design view, right-click the LoginView control, and then click Show Common Control Tasks.

  2. On the Common LoginView Tasks menu, choose AnonymousTemplate, LoggedInTemplate, or any RoleGroup you have defined in the Views dropdown. The template changes to the view you choose.

  3. Add text, controls, and formatting to the template.

For a full description of all LoginView control properties, see LoginView in the MSDN library.

See also

Concepts

ASP.NET login controls overview

ChangePassword control

CreateUserWizard control

Login control

LoginName control

PasswordRecovery control