LoginView

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 panel to your page.

  2. By default, the LoginView control includes two template 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 Cc295194.xtlink_newWindow(en-us,Expression.40).png 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 Members Cc295194.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

See also

Concepts

ASP.NET Login controls
ChangePassword
CreateUserWizard
Login
LoginName
PasswordRecovery

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.