Blazor UI: Current User

ICurrentUser service is used to obtain information about the currently authenticated user. Inject the ICurrentUser into any component/page and use its properties and methods.

Example: Show username & email on a page

@page "/"
@using Volo.Abp.Users
@inject ICurrentUser CurrentUser
@if (CurrentUser.IsAuthenticated)
{
    <p>Welcome @CurrentUser.UserName</p>
}

If you (directly or indirectly) derived your component from the AbpComponentBase, you can directly use the base CurrentUser property.

ICurrentUser provides Id, Name, SurName, Email, Roles and some other properties.

See the Server Side Current User service for more information.

Contributors


Last updated: July 31, 2024 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

In this document
Community Talks

Building Modular Monolith Applications Using .NET and ABP Framework

17 Oct, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More